File tree 3 files changed +27
-0
lines changed
3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 29
29
#include " qgsmaplayerregistry.h"
30
30
#include " qgsmapcanvas.h"
31
31
#include " qgslegend.h"
32
+ #include " qgsshortcutsmanager.h"
32
33
33
34
QgisAppInterface::QgisAppInterface ( QgisApp * _qgis )
34
35
: qgis( _qgis )
@@ -185,6 +186,18 @@ void QgisAppInterface::refreshLegend( QgsMapLayer *l )
185
186
void QgisAppInterface::addWindow ( QAction *action ) { qgis->addWindow ( action ); }
186
187
void QgisAppInterface::removeWindow ( QAction *action ) { qgis->removeWindow ( action ); }
187
188
189
+
190
+ bool QgisAppInterface::registerMainWindowAction ( QAction* action, QString defaultShortcut )
191
+ {
192
+ return QgsShortcutsManager::instance ()->registerAction ( action, defaultShortcut );
193
+ }
194
+
195
+ bool QgisAppInterface::unregisterMainWindowAction ( QAction* action )
196
+ {
197
+ return QgsShortcutsManager::instance ()->unregisterAction ( action );
198
+ }
199
+
200
+
188
201
// ! Menus
189
202
QMenu *QgisAppInterface::fileMenu () { return qgis->fileMenu (); }
190
203
QMenu *QgisAppInterface::editMenu () { return qgis->editMenu (); }
Original file line number Diff line number Diff line change @@ -116,6 +116,14 @@ class QgisAppInterface : public QgisInterface
116
116
* windows which are hidden rather than deleted when closed. */
117
117
virtual void removeWindow ( QAction *action );
118
118
119
+ /* * Register action to the shortcuts manager so its shortcut can be changed in GUI.
120
+ @note added in version 1.2. */
121
+ virtual bool registerMainWindowAction ( QAction* action, QString defaultShortcut );
122
+
123
+ /* * Unregister a previously registered action. (e.g. when plugin is going to be unloaded.
124
+ @note added in version 1.2. */
125
+ virtual bool unregisterMainWindowAction ( QAction* action );
126
+
119
127
/* * Accessors for inserting items into menus and toolbars.
120
128
* An item can be inserted before any existing action.
121
129
*/
Original file line number Diff line number Diff line change @@ -135,6 +135,12 @@ class GUI_EXPORT QgisInterface : public QObject
135
135
* windows which are hidden rather than deleted when closed. */
136
136
virtual void removeWindow ( QAction *action ) = 0;
137
137
138
+ /* * Register action to the shortcuts manager so its shortcut can be changed in GUI */
139
+ virtual bool registerMainWindowAction ( QAction* action, QString defaultShortcut ) = 0;
140
+
141
+ /* * Unregister a previously registered action. (e.g. when plugin is going to be unloaded */
142
+ virtual bool unregisterMainWindowAction ( QAction* action ) = 0;
143
+
138
144
// TODO: is this deprecated in favour of QgsContextHelp?
139
145
/* * Open a url in the users browser. By default the QGIS doc directory is used
140
146
* as the base for the URL. To open a URL that is not relative to the installed
You can’t perform that action at this time.
0 commit comments