9 changes: 9 additions & 0 deletions src/core/composer/qgslegendmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ class CORE_EXPORT QgsLegendModel: public QStandardItemModel
void updateRasterClassificationItem( QStandardItem* classificationItem )
{ Q_UNUSED( classificationItem ); }

/** Update single item text using item userText and other properties like showFeatureCount */
void updateItemText( QStandardItem* item );


bool writeXML( QDomElement& composerLegendElem, QDomDocument& doc ) const;
bool readXML( const QDomElement& legendModelElem, const QDomDocument& doc );

Expand Down Expand Up @@ -106,6 +110,11 @@ class CORE_EXPORT QgsLegendModel: public QStandardItemModel
@return 0 in case of success*/
int addRasterLayerItems( QStandardItem* layerItem, QgsMapLayer* rlayer );

void updateLayerItemText( QStandardItem* layerItem );
void updateSymbolV2ItemText( QStandardItem* symbolItem );
void updateRasterSymbolItemText( QStandardItem* symbolItem );


protected:
QStringList mLayerIds;
/**True if this application has toplevel windows (normally true). If this is false, this means that the application
Expand Down
33 changes: 23 additions & 10 deletions src/ui/qgscomposerlegendwidgetbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-118</y>
<y>0</y>
<width>369</width>
<height>1088</height>
</rect>
Expand Down Expand Up @@ -141,17 +141,13 @@
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QToolButton" name="mAddGroupButton">
<property name="text">
<string>Add group</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="mUpdatePushButton">
<property name="toolTip">
<string>Update legend. User defined labels are preserved.</string>
</property>
<property name="text">
<string>Update</string>
<string>Update item</string>
</property>
<property name="iconSize">
<size>
Expand All @@ -163,8 +159,11 @@
</item>
<item>
<widget class="QToolButton" name="mUpdateAllPushButton">
<property name="toolTip">
<string>Update whole legend. Layers are added/removed according to main application legend. User defined labels will be deleted.</string>
</property>
<property name="text">
<string>All</string>
<string>Update all</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -247,6 +246,20 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="mAddGroupToolButton">
<property name="toolTip">
<string>Add group</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionAddGroup.png</normaloff>:/images/themes/default/mActionAddGroup.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="mAddToolButton">
<property name="text">
Expand Down