[QGIS Commit] r12225 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Nov 22 17:26:16 EST 2009


Author: jef
Date: 2009-11-22 17:26:15 -0500 (Sun, 22 Nov 2009)
New Revision: 12225

Modified:
   trunk/qgis/src/app/qgsidentifyresults.cpp
   trunk/qgis/src/app/qgsidentifyresults.h
Log:
fix #2138

Modified: trunk/qgis/src/app/qgsidentifyresults.cpp
===================================================================
--- trunk/qgis/src/app/qgsidentifyresults.cpp	2009-11-22 21:50:09 UTC (rev 12224)
+++ trunk/qgis/src/app/qgsidentifyresults.cpp	2009-11-22 22:26:15 UTC (rev 12225)
@@ -49,9 +49,10 @@
 
 void QgsFeatureAction::execute()
 {
+  int idx;
   QList< QPair<QString, QString> > attributes;
-  mResults->retrieveAttributes( mFeatItem, attributes );
-  mLayer->actions()->doAction( mAction, attributes, 0, _runPythonString );
+  mResults->retrieveAttributes( mFeatItem, attributes, idx );
+  mLayer->actions()->doAction( mAction, attributes, idx, _runPythonString );
 }
 
 class QgsIdentifyResultsDock : public QDockWidget
@@ -442,8 +443,9 @@
 
 void QgsIdentifyResults::doAction( QTreeWidgetItem *item, int action )
 {
+  int idx;
   QList< QPair<QString, QString> > attributes;
-  QTreeWidgetItem *featItem = retrieveAttributes( item, attributes );
+  QTreeWidgetItem *featItem = retrieveAttributes( item, attributes, idx );
   if ( !featItem )
     return;
 
@@ -451,7 +453,7 @@
   if ( !layer )
     return;
 
-  int idx = -1;
+  idx = -1;
   if ( item->parent() == featItem )
   {
     QString fieldName = item->data( 0, Qt::DisplayRole ).toString();
@@ -516,16 +518,20 @@
 }
 
 
-QTreeWidgetItem *QgsIdentifyResults::retrieveAttributes( QTreeWidgetItem *item, QList< QPair<QString, QString> > &attributes )
+QTreeWidgetItem *QgsIdentifyResults::retrieveAttributes( QTreeWidgetItem *item, QList< QPair<QString, QString> > &attributes, int &idx )
 {
   QTreeWidgetItem *featItem = featureItem( item );
 
+  idx = -1;
+
   attributes.clear();
   for ( int i = 0; i < featItem->childCount(); i++ )
   {
     QTreeWidgetItem *item = featItem->child( i );
     if ( item->childCount() > 0 )
       continue;
+    if( item==lstResults->currentItem() )
+      idx = attributes.size();
     attributes << QPair<QString, QString>( item->data( 0, Qt::DisplayRole ).toString(), item->data( 1, Qt::DisplayRole ).toString() );
   }
 
@@ -785,8 +791,9 @@
   QClipboard *clipboard = QApplication::clipboard();
   QString text;
 
+  int idx;
   QList< QPair<QString, QString> > attributes;
-  retrieveAttributes( lstResults->currentItem(), attributes );
+  retrieveAttributes( lstResults->currentItem(), attributes, idx );
 
   for ( QList< QPair<QString, QString> >::iterator it = attributes.begin(); it != attributes.end(); it++ )
   {

Modified: trunk/qgis/src/app/qgsidentifyresults.h
===================================================================
--- trunk/qgis/src/app/qgsidentifyresults.h	2009-11-22 21:50:09 UTC (rev 12224)
+++ trunk/qgis/src/app/qgsidentifyresults.h	2009-11-22 22:26:15 UTC (rev 12225)
@@ -101,7 +101,7 @@
     /* Item in tree was clicked */
     void itemClicked( QTreeWidgetItem *lvi, int column );
 
-    QTreeWidgetItem *retrieveAttributes( QTreeWidgetItem *item, QList< QPair<QString, QString> > &attributes );
+    QTreeWidgetItem *retrieveAttributes( QTreeWidgetItem *item, QList< QPair<QString, QString> > &attributes, int &currentIdx );
 
     void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
 



More information about the QGIS-commit mailing list