Skip to content

Commit bba75a8

Browse files
committedDec 2, 2012
Add legend icon for editable layers with unsaved edits
1 parent eb5ba34 commit bba75a8

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed
 

‎images/images.qrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@
185185
<file>themes/default/mIconDbSchema.png</file>
186186
<file>themes/default/mIconDelete.png</file>
187187
<file>themes/default/mIconEditable.png</file>
188+
<file>themes/default/mIconEditableEdits.png</file>
188189
<file>themes/default/mIconExpand.png</file>
189190
<file>themes/default/mIconFavourites.png</file>
190191
<file>themes/default/mIconFirst.png</file>
@@ -384,6 +385,7 @@
384385
<file>themes/gis/mActionZoomToSelected.png</file>
385386
<file>themes/gis/mIconClose.png</file>
386387
<file>themes/gis/mIconEditable.png</file>
388+
<file>themes/gis/mIconEditableEdits.png</file>
387389
<file>themes/gis/mIconLineLayer.png</file>
388390
<file>themes/gis/mIconPointLayer.png</file>
389391
<file>themes/gis/mIconPolygonLayer.png</file>
972 Bytes
Loading
971 Bytes
Loading

‎src/app/legend/qgslegendlayer.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,16 @@ void QgsLegendLayer::updateIcon()
335335
//editable
336336
if ( theLayer->isEditable() )
337337
{
338-
QPixmap myPixmap = QgsApplication::getThemePixmap( "/mIconEditable.png" );
338+
QPixmap myPixmap;
339+
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer *>( theLayer );
340+
if ( vlayer->isModified() )
341+
{
342+
myPixmap = QgsApplication::getThemePixmap( "/mIconEditableEdits.png" );
343+
}
344+
else
345+
{
346+
myPixmap = QgsApplication::getThemePixmap( "/mIconEditable.png" );
347+
}
339348
// use editable icon instead of the layer's type icon
340349
newIcon = myPixmap;
341350

@@ -606,6 +615,7 @@ void QgsLegendLayer::updateAfterLayerModification( bool onlyGeomChanged )
606615

607616
if ( onlyGeomChanged )
608617
{
618+
updateIcon();
609619
return;
610620
}
611621

1 commit comments

Comments
 (1)

slarosa commented on Dec 2, 2012

@slarosa
Member

Very nice !

Thanks !

Please sign in to comment.