@@ -109,10 +109,9 @@ QgsStyleV2ManagerDialog::QgsStyleV2ManagerDialog( QgsStyleV2* style, QWidget* pa
109
109
110
110
QMenu *groupMenu = new QMenu ( tr ( " Group actions" ), this );
111
111
QAction *groupSymbols = groupMenu->addAction ( tr ( " Group symbols" ) );
112
- QAction *editSmartgroup = groupMenu->addAction ( tr ( " Edit smart group " ) );
112
+ groupMenu->addAction ( actnEditSmartGroup );
113
113
btnManageGroups->setMenu ( groupMenu );
114
114
connect ( groupSymbols, SIGNAL ( triggered () ), this , SLOT ( groupSymbolsAction () ) );
115
- connect ( editSmartgroup, SIGNAL ( triggered () ), this , SLOT ( editSmartgroupAction () ) );
116
115
117
116
connect ( searchBox, SIGNAL ( textChanged ( QString ) ), this , SLOT ( filterSymbols ( QString ) ) );
118
117
tagsLineEdit->installEventFilter ( this );
@@ -935,6 +934,27 @@ void QgsStyleV2ManagerDialog::groupChanged( const QModelIndex& index )
935
934
}
936
935
if ( mGrouppingMode )
937
936
setSymbolsChecked ( groupSymbols );
937
+
938
+ actnEditSmartGroup->setVisible ( false );
939
+ actnAddGroup->setVisible ( false );
940
+ actnRemoveGroup->setVisible ( false );
941
+
942
+ if ( index.parent ().isValid () && ( index.data ().toString () != " Ungrouped" ) )
943
+ {
944
+ if ( index.parent ().data ( Qt::UserRole + 1 ).toString () == " smartgroups" )
945
+ {
946
+ actnEditSmartGroup->setVisible ( true );
947
+ }
948
+ else
949
+ {
950
+ actnAddGroup->setVisible ( true );
951
+ }
952
+ actnRemoveGroup->setVisible ( true );
953
+ }
954
+ else if ( index.data ( Qt::UserRole + 1 ) == " groups" || index.data ( Qt::UserRole + 1 ) == " smartgroups" )
955
+ {
956
+ actnAddGroup->setVisible ( true );
957
+ }
938
958
}
939
959
940
960
void QgsStyleV2ManagerDialog::addGroup ()
@@ -1324,28 +1344,8 @@ void QgsStyleV2ManagerDialog::grouptreeContextMenu( const QPoint& point )
1324
1344
QModelIndex index = groupTree->indexAt ( point );
1325
1345
QgsDebugMsg ( " Now you clicked: " + index.data ().toString () );
1326
1346
1327
- actnEditSmartGroup->setVisible ( false );
1328
- actnAddGroup->setVisible ( false );
1329
- actnRemoveGroup->setVisible ( false );
1330
-
1331
- if ( index.parent ().isValid () && ( index.data ().toString () != " Ungrouped" ) )
1332
- {
1333
- if ( index.parent ().data ( Qt::UserRole + 1 ).toString () == " smartgroups" )
1334
- {
1335
- actnEditSmartGroup->setVisible ( true );
1336
- }
1337
- else
1338
- {
1339
- actnAddGroup->setVisible ( true );
1340
- }
1341
- actnRemoveGroup->setVisible ( true );
1342
- }
1343
- else if ( index.data ( Qt::UserRole + 1 ) == " groups" || index.data ( Qt::UserRole + 1 ) == " smartgroups" )
1344
- {
1345
- actnAddGroup->setVisible ( true );
1346
- }
1347
-
1348
- mGroupTreeContextMenu ->popup ( globalPos );
1347
+ if ( index.isValid () )
1348
+ mGroupTreeContextMenu ->popup ( globalPos );
1349
1349
}
1350
1350
1351
1351
void QgsStyleV2ManagerDialog::listitemsContextMenu ( const QPoint& point )
0 commit comments