[QGIS Commit] r14749 - in trunk/qgis: python/gui src/app src/gui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Nov 23 07:25:24 EST 2010


Author: jef
Date: 2010-11-23 04:25:24 -0800 (Tue, 23 Nov 2010)
New Revision: 14749

Modified:
   trunk/qgis/python/gui/qgisinterface.sip
   trunk/qgis/src/app/qgisappinterface.cpp
   trunk/qgis/src/app/qgisappinterface.h
   trunk/qgis/src/gui/qgisinterface.h
Log:
allow opening attribute table from plugins

Modified: trunk/qgis/python/gui/qgisinterface.sip
===================================================================
--- trunk/qgis/python/gui/qgisinterface.sip	2010-11-23 05:31:46 UTC (rev 14748)
+++ trunk/qgis/python/gui/qgisinterface.sip	2010-11-23 12:25:24 UTC (rev 14749)
@@ -117,6 +117,11 @@
      */
     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;

Modified: trunk/qgis/src/app/qgisappinterface.cpp
===================================================================
--- trunk/qgis/src/app/qgisappinterface.cpp	2010-11-23 05:31:46 UTC (rev 14748)
+++ trunk/qgis/src/app/qgisappinterface.cpp	2010-11-23 12:25:24 UTC (rev 14749)
@@ -36,6 +36,7 @@
 #include "qgsvectordataprovider.h"
 #include "qgsfeatureaction.h"
 #include "qgsattributeaction.h"
+#include "qgsattributetabledialog.h"
 
 QgisAppInterface::QgisAppInterface( QgisApp * _qgis )
     : qgis( _qgis ),
@@ -231,10 +232,25 @@
   }
 }
 
-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 )
 {
   return QgsShortcutsManager::instance()->registerAction( action, defaultShortcut );

Modified: trunk/qgis/src/app/qgisappinterface.h
===================================================================
--- trunk/qgis/src/app/qgisappinterface.h	2010-11-23 05:31:46 UTC (rev 14748)
+++ trunk/qgis/src/app/qgisappinterface.h	2010-11-23 12:25:24 UTC (rev 14749)
@@ -120,8 +120,18 @@
 
     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 );

Modified: trunk/qgis/src/gui/qgisinterface.h
===================================================================
--- trunk/qgis/src/gui/qgisinterface.h	2010-11-23 05:31:46 UTC (rev 14748)
+++ trunk/qgis/src/gui/qgisinterface.h	2010-11-23 12:25:24 UTC (rev 14749)
@@ -126,11 +126,15 @@
 
     /** 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;
 
@@ -150,6 +154,11 @@
      */
     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;
@@ -346,7 +355,7 @@
 
         Added in v1.6
       */
-     void newProjectCreated();
+    void newProjectCreated();
 
 };
 



More information about the QGIS-commit mailing list