|
| 1 | +/*************************************************************************** |
| 2 | + qgsfeatureaction.cpp - description |
| 3 | + ------------------- |
| 4 | + begin : 2010-09-20 |
| 5 | + copyright : (C) 2010 by Jürgen E. Fischer |
| 6 | + email : jef at norbit dot de |
| 7 | + ***************************************************************************/ |
| 8 | + |
| 9 | +/*************************************************************************** |
| 10 | + * * |
| 11 | + * This program is free software; you can redistribute it and/or modify * |
| 12 | + * it under the terms of the GNU General Public License as published by * |
| 13 | + * the Free Software Foundation; either version 2 of the License, or * |
| 14 | + * (at your option) any later version. * |
| 15 | + * * |
| 16 | + ***************************************************************************/ |
| 17 | +/* $Id$ */ |
| 18 | + |
| 19 | +#include "qgsfeatureaction.h" |
| 20 | +#include "qgsvectorlayer.h" |
| 21 | +#include "qgsidentifyresults.h" |
| 22 | + |
| 23 | +QgsFeatureAction::QgsFeatureAction( const QString &name, QgsIdentifyResults *results, QgsVectorLayer *vl, int action, QTreeWidgetItem *featItem ) |
| 24 | + : QAction( name, results ) |
| 25 | + , mLayer( vl ) |
| 26 | + , mAction( action ) |
| 27 | +{ |
| 28 | + results->retrieveAttributes( featItem, mAttributes, mIdx ); |
| 29 | +} |
| 30 | + |
| 31 | +QgsFeatureAction::QgsFeatureAction( const QString &name, QgsFeature &f, QgsVectorLayer *layer, int action, QObject *parent ) |
| 32 | + : QAction( name, parent ) |
| 33 | + , mLayer( layer ) |
| 34 | + , mAction( action ) |
| 35 | +{ |
| 36 | + mAttributes = f.attributeMap(); |
| 37 | +} |
| 38 | + |
| 39 | +void QgsFeatureAction::execute() |
| 40 | +{ |
| 41 | + mLayer->actions()->doAction( mAction, mAttributes, mIdx ); |
| 42 | +} |
0 commit comments