Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
allow attribute and alias names in actions
git-svn-id: http://svn.osgeo.org/qgis/trunk@14283 c8812cc2-4d05-0410-92ff-de0c093fc19c
- Loading branch information
jef
committed
Sep 25, 2010
1 parent
ff198a8
commit c8c0172
Showing
12 changed files
with
303 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/*************************************************************************** | ||
qgsfeatureaction.cpp - description | ||
------------------- | ||
begin : 2010-09-20 | ||
copyright : (C) 2010 by Jürgen E. Fischer | ||
email : jef at norbit dot de | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
/* $Id$ */ | ||
|
||
#include "qgsfeatureaction.h" | ||
#include "qgsvectorlayer.h" | ||
#include "qgsidentifyresults.h" | ||
|
||
QgsFeatureAction::QgsFeatureAction( const QString &name, QgsIdentifyResults *results, QgsVectorLayer *vl, int action, QTreeWidgetItem *featItem ) | ||
: QAction( name, results ) | ||
, mLayer( vl ) | ||
, mAction( action ) | ||
{ | ||
results->retrieveAttributes( featItem, mAttributes, mIdx ); | ||
} | ||
|
||
QgsFeatureAction::QgsFeatureAction( const QString &name, QgsFeature &f, QgsVectorLayer *layer, int action, QObject *parent ) | ||
: QAction( name, parent ) | ||
, mLayer( layer ) | ||
, mAction( action ) | ||
{ | ||
mAttributes = f.attributeMap(); | ||
} | ||
|
||
void QgsFeatureAction::execute() | ||
{ | ||
mLayer->actions()->doAction( mAction, mAttributes, mIdx ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/*************************************************************************** | ||
qgsfeatureaction.h - description | ||
------------------ | ||
begin : 2010-09-20 | ||
copyright : (C) 2010 by Jürgen E. Fischer | ||
email : jef at norbit dot de | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
/* $Id$ */ | ||
#ifndef QGSFEATUREACTION_H | ||
#define QGSFEATUREACTION_H | ||
|
||
#include "qgsfeature.h" | ||
|
||
#include <QList> | ||
#include <QPair> | ||
#include <QAction> | ||
|
||
class QgsIdentifyResults; | ||
class QgsVectorLayer; | ||
class QTreeWidgetItem; | ||
|
||
class QgsFeatureAction : public QAction | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
QgsFeatureAction( const QString &name, QgsFeature &f, QgsVectorLayer *vl, int action, QObject *parent ); | ||
QgsFeatureAction( const QString &name, QgsIdentifyResults *results, QgsVectorLayer *vl, int action, QTreeWidgetItem *featItem ); | ||
|
||
public slots: | ||
void execute(); | ||
|
||
private: | ||
QgsVectorLayer *mLayer; | ||
int mAction; | ||
int mIdx; | ||
QgsAttributeMap mAttributes; | ||
}; | ||
|
||
#endif |
Oops, something went wrong.