Skip to content
Permalink
Browse files
fix #2138
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12225 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Nov 22, 2009
1 parent 7f287d8 commit b056f5392faf2d90fa9a574675a2c74bed200b9f
Showing with 14 additions and 7 deletions.
  1. +13 −6 src/app/qgsidentifyresults.cpp
  2. +1 −1 src/app/qgsidentifyresults.h
@@ -49,9 +49,10 @@ static void _runPythonString( const QString &expr )

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,16 +443,17 @@ void QgsIdentifyResults::clearRubberBand()

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;

QgsVectorLayer *layer = qobject_cast<QgsVectorLayer *>( featItem->parent()->data( 0, Qt::UserRole ).value<QObject *>() );
if ( !layer )
return;

int idx = -1;
idx = -1;
if ( item->parent() == featItem )
{
QString fieldName = item->data( 0, Qt::DisplayRole ).toString();
@@ -516,16 +518,20 @@ QgsVectorLayer *QgsIdentifyResults::vectorLayer( QTreeWidgetItem *item )
}


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 @@ void QgsIdentifyResults::copyFeatureAttributes()
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++ )
{
@@ -101,7 +101,7 @@ class QgsIdentifyResults: public QDialog, private Ui::QgsIdentifyResultsBase
/* 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() ); }

0 comments on commit b056f53

Please sign in to comment.