Skip to content

Commit 009c8e5

Browse files
author
jef
committed
allow opening attribute table from plugins
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14749 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 874eb33 commit 009c8e5

File tree

4 files changed

+44
-4
lines changed

4 files changed

+44
-4
lines changed

python/gui/qgisinterface.sip

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ class QgisInterface : QObject
117117
*/
118118
virtual void showLayerProperties( QgsMapLayer * layer )=0;
119119

120+
/** open attribute table
121+
\note added in 1.7
122+
*/
123+
virtual void showAttributeTable( QgsVectorLayer * layer )=0;
124+
120125
/** Add window to Window menu. The action title is the window title
121126
* and the action should raise, unminimize and activate the window. */
122127
virtual void addWindow( QAction *action ) = 0;

src/app/qgisappinterface.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "qgsvectordataprovider.h"
3737
#include "qgsfeatureaction.h"
3838
#include "qgsattributeaction.h"
39+
#include "qgsattributetabledialog.h"
3940

4041
QgisAppInterface::QgisAppInterface( QgisApp * _qgis )
4142
: qgis( _qgis ),
@@ -231,9 +232,24 @@ void QgisAppInterface::showLayerProperties( QgsMapLayer *l )
231232
}
232233
}
233234

234-
void QgisAppInterface::addWindow( QAction *action ) { qgis->addWindow( action ); }
235-
void QgisAppInterface::removeWindow( QAction *action ) { qgis->removeWindow( action ); }
235+
void QgisAppInterface::showAttributeTable( QgsVectorLayer *l )
236+
{
237+
if ( l )
238+
{
239+
QgsAttributeTableDialog *dialog = new QgsAttributeTableDialog( l );
240+
dialog->show();
241+
}
242+
}
236243

244+
void QgisAppInterface::addWindow( QAction *action )
245+
{
246+
qgis->addWindow( action );
247+
}
248+
249+
void QgisAppInterface::removeWindow( QAction *action )
250+
{
251+
qgis->removeWindow( action );
252+
}
237253

238254
bool QgisAppInterface::registerMainWindowAction( QAction* action, QString defaultShortcut )
239255
{

src/app/qgisappinterface.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,18 @@ class QgisAppInterface : public QgisInterface
120120

121121
virtual void refreshLegend( QgsMapLayer *l );
122122

123+
/** show layer properties dialog for layer
124+
* @param l layer to show properties table for
125+
* @note added in added in 1.5
126+
*/
123127
virtual void showLayerProperties( QgsMapLayer *l );
124128

129+
/** show layer attribute dialog for layer
130+
* @param l layer to show attribute table for
131+
* @note added in added in 1.7
132+
*/
133+
virtual void showAttributeTable( QgsVectorLayer *l );
134+
125135
/** Add window to Window menu. The action title is the window title
126136
* and the action should raise, unminimize and activate the window. */
127137
virtual void addWindow( QAction *action );

src/gui/qgisinterface.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,15 @@ class GUI_EXPORT QgisInterface : public QObject
126126

127127
/** Add action to the plugins menu */
128128
virtual void addPluginToMenu( QString name, QAction* action ) = 0;
129+
129130
/** Remove action from the plugins menu */
130131
virtual void removePluginMenu( QString name, QAction* action ) = 0;
131132

132-
/** Add action to the Database menu */
133+
/** Add action to the Database menu
134+
* @note added in 1.7
135+
*/
133136
virtual void addPluginToDatabaseMenu( QString name, QAction* action ) = 0;
137+
134138
/** Remove action from the Database menu */
135139
virtual void removePluginDatabaseMenu( QString name, QAction* action ) = 0;
136140

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

157+
/** open attribute table dialog
158+
\note added in 1.7
159+
*/
160+
virtual void showAttributeTable( QgsVectorLayer *l ) = 0;
161+
153162
/** Add window to Window menu. The action title is the window title
154163
* and the action should raise, unminimize and activate the window. */
155164
virtual void addWindow( QAction *action ) = 0;
@@ -346,7 +355,7 @@ class GUI_EXPORT QgisInterface : public QObject
346355
347356
Added in v1.6
348357
*/
349-
void newProjectCreated();
358+
void newProjectCreated();
350359

351360
};
352361

0 commit comments

Comments
 (0)