Skip to content

Commit

Permalink
allow opening attribute table from plugins
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14749 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Nov 23, 2010
1 parent 874eb33 commit 009c8e5
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
5 changes: 5 additions & 0 deletions python/gui/qgisinterface.sip
Expand Up @@ -117,6 +117,11 @@ class QgisInterface : QObject
*/
virtual void showLayerProperties( QgsMapLayer * layer )=0;

/** open attribute table
\note added in 1.7
*/
virtual void showAttributeTable( QgsVectorLayer * layer )=0;

/** Add window to Window menu. The action title is the window title
* and the action should raise, unminimize and activate the window. */
virtual void addWindow( QAction *action ) = 0;
Expand Down
20 changes: 18 additions & 2 deletions src/app/qgisappinterface.cpp
Expand Up @@ -36,6 +36,7 @@
#include "qgsvectordataprovider.h"
#include "qgsfeatureaction.h"
#include "qgsattributeaction.h"
#include "qgsattributetabledialog.h"

QgisAppInterface::QgisAppInterface( QgisApp * _qgis )
: qgis( _qgis ),
Expand Down Expand Up @@ -231,9 +232,24 @@ void QgisAppInterface::showLayerProperties( QgsMapLayer *l )
}
}

void QgisAppInterface::addWindow( QAction *action ) { qgis->addWindow( action ); }
void QgisAppInterface::removeWindow( QAction *action ) { qgis->removeWindow( action ); }
void QgisAppInterface::showAttributeTable( QgsVectorLayer *l )
{
if ( l )
{
QgsAttributeTableDialog *dialog = new QgsAttributeTableDialog( l );
dialog->show();
}
}

void QgisAppInterface::addWindow( QAction *action )
{
qgis->addWindow( action );
}

void QgisAppInterface::removeWindow( QAction *action )
{
qgis->removeWindow( action );
}

bool QgisAppInterface::registerMainWindowAction( QAction* action, QString defaultShortcut )
{
Expand Down
10 changes: 10 additions & 0 deletions src/app/qgisappinterface.h
Expand Up @@ -120,8 +120,18 @@ class QgisAppInterface : public QgisInterface

virtual void refreshLegend( QgsMapLayer *l );

/** show layer properties dialog for layer
* @param l layer to show properties table for
* @note added in added in 1.5
*/
virtual void showLayerProperties( QgsMapLayer *l );

/** show layer attribute dialog for layer
* @param l layer to show attribute table for
* @note added in added in 1.7
*/
virtual void showAttributeTable( QgsVectorLayer *l );

/** Add window to Window menu. The action title is the window title
* and the action should raise, unminimize and activate the window. */
virtual void addWindow( QAction *action );
Expand Down
13 changes: 11 additions & 2 deletions src/gui/qgisinterface.h
Expand Up @@ -126,11 +126,15 @@ class GUI_EXPORT QgisInterface : public QObject

/** Add action to the plugins menu */
virtual void addPluginToMenu( QString name, QAction* action ) = 0;

/** Remove action from the plugins menu */
virtual void removePluginMenu( QString name, QAction* action ) = 0;

/** Add action to the Database menu */
/** Add action to the Database menu
* @note added in 1.7
*/
virtual void addPluginToDatabaseMenu( QString name, QAction* action ) = 0;

/** Remove action from the Database menu */
virtual void removePluginDatabaseMenu( QString name, QAction* action ) = 0;

Expand All @@ -150,6 +154,11 @@ class GUI_EXPORT QgisInterface : public QObject
*/
virtual void showLayerProperties( QgsMapLayer *l ) = 0;

/** open attribute table dialog
\note added in 1.7
*/
virtual void showAttributeTable( QgsVectorLayer *l ) = 0;

/** Add window to Window menu. The action title is the window title
* and the action should raise, unminimize and activate the window. */
virtual void addWindow( QAction *action ) = 0;
Expand Down Expand Up @@ -346,7 +355,7 @@ class GUI_EXPORT QgisInterface : public QObject
Added in v1.6
*/
void newProjectCreated();
void newProjectCreated();

};

Expand Down

0 comments on commit 009c8e5

Please sign in to comment.