7 changes: 5 additions & 2 deletions src/gui/symbology-ng/qgsrendererv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ QgsRendererV2Widget::QgsRendererV2Widget( QgsVectorLayer* layer, QgsStyleV2* sty
{
contextMenu = new QMenu( "Renderer Options " );

contextMenu->addAction( tr( "Copy" ), this, SLOT( copy() ) );
contextMenu->addAction( tr( "Paste" ), this, SLOT( paste() ) );
mCopyAction = contextMenu->addAction( tr( "Copy" ), this, SLOT( copy() ) );
mCopyAction->setShortcut( QKeySequence( QKeySequence::Copy ) );
mPasteAction = contextMenu->addAction( tr( "Paste" ), this, SLOT( paste() ) );
mPasteAction->setShortcut( QKeySequence( QKeySequence::Paste ) );

contextMenu->addSeparator();
contextMenu->addAction( tr( "Change color" ), this, SLOT( changeSymbolColor( ) ) );
contextMenu->addAction( tr( "Change transparency" ), this, SLOT( changeSymbolTransparency() ) );
contextMenu->addAction( tr( "Change output unit" ), this, SLOT( changeSymbolUnit() ) );
Expand Down
2 changes: 2 additions & 0 deletions src/gui/symbology-ng/qgsrendererv2widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class GUI_EXPORT QgsRendererV2Widget : public QWidget
QgsVectorLayer* mLayer;
QgsStyleV2* mStyle;
QMenu* contextMenu;
QAction* mCopyAction;
QAction* mPasteAction;

/**Subclasses may provide the capability of changing multiple symbols at once by implementing the following two methods
and by connecting the slot contextMenuViewCategories(const QPoint&)*/
Expand Down
8 changes: 8 additions & 0 deletions src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ QgsRuleBasedRendererV2Widget::QgsRuleBasedRendererV2Widget( QgsVectorLayer* laye
//new ModelTest( mModel, this ); // for model validity checking
viewRules->setModel( mModel );

mDeleteAction = new QAction( tr( "Remove Rule"), this );
mDeleteAction->setShortcut( QKeySequence( QKeySequence::Delete ) );

viewRules->addAction( mDeleteAction );
viewRules->addAction( mCopyAction );
viewRules->addAction( mPasteAction );

mRefineMenu = new QMenu( tr( "Refine current rule" ), btnRefineRule );
mRefineMenu->addAction( tr( "Add scales to rule" ), this, SLOT( refineRuleScales() ) );
mRefineMenu->addAction( tr( "Add categories to rule" ), this, SLOT( refineRuleCategories() ) );
Expand All @@ -87,6 +94,7 @@ QgsRuleBasedRendererV2Widget::QgsRuleBasedRendererV2Widget( QgsVectorLayer* laye
connect( btnAddRule, SIGNAL( clicked() ), this, SLOT( addRule() ) );
connect( btnEditRule, SIGNAL( clicked() ), this, SLOT( editRule() ) );
connect( btnRemoveRule, SIGNAL( clicked() ), this, SLOT( removeRule() ) );
connect( mDeleteAction, SIGNAL( triggered() ), this, SLOT( removeRule() ) );
connect( btnCountFeatures, SIGNAL( clicked() ), this, SLOT( countFeatures() ) );

connect( btnRenderingOrder, SIGNAL( clicked() ), this, SLOT( setRenderingOrder() ) );
Expand Down
1 change: 1 addition & 0 deletions src/gui/symbology-ng/qgsrulebasedrendererv2widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class GUI_EXPORT QgsRuleBasedRendererV2Widget : public QgsRendererV2Widget, priv
QgsRuleBasedRendererV2Model* mModel;

QMenu* mRefineMenu;
QAction* mDeleteAction;

protected slots:
void copy();
Expand Down