Skip to content

Commit 41ef0a9

Browse files
committed
Rule copy and paste shortcut keys
1 parent 7c9d859 commit 41ef0a9

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/gui/symbology-ng/qgsrendererv2widget.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ QgsRendererV2Widget::QgsRendererV2Widget( QgsVectorLayer* layer, QgsStyleV2* sty
2727
{
2828
contextMenu = new QMenu( "Renderer Options " );
2929

30-
contextMenu->addAction( tr( "Copy" ), this, SLOT( copy() ) );
31-
contextMenu->addAction( tr( "Paste" ), this, SLOT( paste() ) );
30+
mCopyAction = contextMenu->addAction( tr( "Copy" ), this, SLOT( copy() ) );
31+
mCopyAction->setShortcut( QKeySequence( QKeySequence::Copy ) );
32+
mPasteAction = contextMenu->addAction( tr( "Paste" ), this, SLOT( paste() ) );
33+
mPasteAction->setShortcut( QKeySequence( QKeySequence::Paste ) );
3234

3335
contextMenu->addAction( tr( "Change color" ), this, SLOT( changeSymbolColor( ) ) );
3436
contextMenu->addAction( tr( "Change transparency" ), this, SLOT( changeSymbolTransparency() ) );

src/gui/symbology-ng/qgsrendererv2widget.h

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ class GUI_EXPORT QgsRendererV2Widget : public QWidget
5353
QgsVectorLayer* mLayer;
5454
QgsStyleV2* mStyle;
5555
QMenu* contextMenu;
56+
QAction* mCopyAction;
57+
QAction* mPasteAction;
5658

5759
/**Subclasses may provide the capability of changing multiple symbols at once by implementing the following two methods
5860
and by connecting the slot contextMenuViewCategories(const QPoint&)*/

src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ QgsRuleBasedRendererV2Widget::QgsRuleBasedRendererV2Widget( QgsVectorLayer* laye
6565
mModel = new QgsRuleBasedRendererV2Model( mRenderer );
6666
//new ModelTest( mModel, this ); // for model validity checking
6767
viewRules->setModel( mModel );
68+
viewRules->addAction( mCopyAction );
69+
viewRules->addAction( mPasteAction );
6870

6971
mRefineMenu = new QMenu( tr( "Refine current rule" ), btnRefineRule );
7072
mRefineMenu->addAction( tr( "Add scales to rule" ), this, SLOT( refineRuleScales() ) );

0 commit comments

Comments
 (0)