Skip to content

Commit

Permalink
Add legend icon for editable layers with unsaved edits
Browse files Browse the repository at this point in the history
  • Loading branch information
dakcarto committed Dec 2, 2012
1 parent eb5ba34 commit bba75a8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions images/images.qrc
Expand Up @@ -185,6 +185,7 @@
<file>themes/default/mIconDbSchema.png</file>
<file>themes/default/mIconDelete.png</file>
<file>themes/default/mIconEditable.png</file>
<file>themes/default/mIconEditableEdits.png</file>
<file>themes/default/mIconExpand.png</file>
<file>themes/default/mIconFavourites.png</file>
<file>themes/default/mIconFirst.png</file>
Expand Down Expand Up @@ -384,6 +385,7 @@
<file>themes/gis/mActionZoomToSelected.png</file>
<file>themes/gis/mIconClose.png</file>
<file>themes/gis/mIconEditable.png</file>
<file>themes/gis/mIconEditableEdits.png</file>
<file>themes/gis/mIconLineLayer.png</file>
<file>themes/gis/mIconPointLayer.png</file>
<file>themes/gis/mIconPolygonLayer.png</file>
Expand Down
Binary file added images/themes/default/mIconEditableEdits.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/themes/gis/mIconEditableEdits.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 11 additions & 1 deletion src/app/legend/qgslegendlayer.cpp
Expand Up @@ -335,7 +335,16 @@ void QgsLegendLayer::updateIcon()
//editable
if ( theLayer->isEditable() )
{
QPixmap myPixmap = QgsApplication::getThemePixmap( "/mIconEditable.png" );
QPixmap myPixmap;
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer *>( theLayer );
if ( vlayer->isModified() )
{
myPixmap = QgsApplication::getThemePixmap( "/mIconEditableEdits.png" );
}
else
{
myPixmap = QgsApplication::getThemePixmap( "/mIconEditable.png" );
}
// use editable icon instead of the layer's type icon
newIcon = myPixmap;

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

if ( onlyGeomChanged )
{
updateIcon();
return;
}

Expand Down

1 comment on commit bba75a8

@slarosa
Copy link
Member

@slarosa slarosa commented on bba75a8 Dec 2, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice !

Thanks !

Please sign in to comment.