Navigation Menu

Skip to content

Commit

Permalink
Extension of QgisInterface so also actions from plugins can be set in…
Browse files Browse the repository at this point in the history
… configure shortcuts dialog.

git-svn-id: http://svn.osgeo.org/qgis/trunk@10741 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed May 5, 2009
1 parent ceb305c commit 3d2bbba
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/app/qgisappinterface.cpp
Expand Up @@ -29,6 +29,7 @@
#include "qgsmaplayerregistry.h"
#include "qgsmapcanvas.h"
#include "qgslegend.h"
#include "qgsshortcutsmanager.h"

QgisAppInterface::QgisAppInterface( QgisApp * _qgis )
: qgis( _qgis )
Expand Down Expand Up @@ -185,6 +186,18 @@ void QgisAppInterface::refreshLegend( QgsMapLayer *l )
void QgisAppInterface::addWindow( QAction *action ) { qgis->addWindow( action ); }
void QgisAppInterface::removeWindow( QAction *action ) { qgis->removeWindow( action ); }


bool QgisAppInterface::registerMainWindowAction( QAction* action, QString defaultShortcut )
{
return QgsShortcutsManager::instance()->registerAction( action, defaultShortcut );
}

bool QgisAppInterface::unregisterMainWindowAction( QAction* action )
{
return QgsShortcutsManager::instance()->unregisterAction( action );
}


//! Menus
QMenu *QgisAppInterface::fileMenu() { return qgis->fileMenu(); }
QMenu *QgisAppInterface::editMenu() { return qgis->editMenu(); }
Expand Down
8 changes: 8 additions & 0 deletions src/app/qgisappinterface.h
Expand Up @@ -116,6 +116,14 @@ class QgisAppInterface : public QgisInterface
* windows which are hidden rather than deleted when closed. */
virtual void removeWindow( QAction *action );

/** Register action to the shortcuts manager so its shortcut can be changed in GUI.
@note added in version 1.2. */
virtual bool registerMainWindowAction( QAction* action, QString defaultShortcut );

/** Unregister a previously registered action. (e.g. when plugin is going to be unloaded.
@note added in version 1.2. */
virtual bool unregisterMainWindowAction( QAction* action );

/** Accessors for inserting items into menus and toolbars.
* An item can be inserted before any existing action.
*/
Expand Down
6 changes: 6 additions & 0 deletions src/gui/qgisinterface.h
Expand Up @@ -135,6 +135,12 @@ class GUI_EXPORT QgisInterface : public QObject
* windows which are hidden rather than deleted when closed. */
virtual void removeWindow( QAction *action ) = 0;

/** Register action to the shortcuts manager so its shortcut can be changed in GUI */
virtual bool registerMainWindowAction( QAction* action, QString defaultShortcut ) = 0;

/** Unregister a previously registered action. (e.g. when plugin is going to be unloaded */
virtual bool unregisterMainWindowAction( QAction* action ) = 0;

// TODO: is this deprecated in favour of QgsContextHelp?
/** Open a url in the users browser. By default the QGIS doc directory is used
* as the base for the URL. To open a URL that is not relative to the installed
Expand Down

0 comments on commit 3d2bbba

Please sign in to comment.