QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
src
gui
qgsactionmenu.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsactionmenu.h
3
--------------------------------------
4
Date : 11.8.2014
5
Copyright : (C) 2014 Matthias Kuhn
6
Email : matthias at opengis dot ch
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
16
#ifndef QGSACTIONMENU_H
17
#define QGSACTIONMENU_H
18
19
#include <QMenu>
20
#include <QSignalMapper>
21
22
#include "
qgsactionmanager.h
"
23
#include "
qgsmaplayeractionregistry.h
"
24
25
30
class
GUI_EXPORT
QgsActionMenu
:
public
QMenu
31
{
32
Q_OBJECT
33
34
public
:
35
enum
ActionType
36
{
37
Invalid
,
38
MapLayerAction
,
39
AttributeAction
40
};
41
42
struct
ActionData
43
{
44
ActionData
()
45
: actionType( Invalid )
46
, actionId( 0 )
47
, featureId( 0 )
48
, mapLayer( nullptr )
49
{}
50
51
ActionData
(
int
actionId,
QgsFeatureId
featureId,
QgsMapLayer
* mapLayer )
52
: actionType( AttributeAction )
53
, actionId( actionId )
54
, featureId( featureId )
55
, mapLayer( mapLayer )
56
{}
57
58
ActionData
(
QgsMapLayerAction
* action,
QgsFeatureId
featureId,
QgsMapLayer
* mapLayer )
59
: actionType( MapLayerAction )
60
, actionId( action )
61
, featureId( featureId )
62
, mapLayer( mapLayer )
63
{}
64
65
ActionType
actionType
;
66
67
union
aid
68
{
69
aid
(
int
i ) : id( i ) {}
70
aid
(
QgsMapLayerAction
* a ) : action( a ) {}
71
int
id
;
72
QgsMapLayerAction
*
action
;
73
} actionId;
74
75
QgsFeatureId
featureId
;
76
QgsMapLayer
*
mapLayer
;
77
};
78
87
explicit
QgsActionMenu
(
QgsVectorLayer
*layer,
const
QgsFeature
*feature,
QWidget
*parent =
nullptr
);
88
96
explicit
QgsActionMenu
(
QgsVectorLayer
*layer,
const
QgsFeatureId
fid,
QWidget
*parent =
nullptr
);
97
101
~
QgsActionMenu
();
102
109
void
setFeature(
QgsFeature
* feature );
110
116
void
setExpressionContextScope(
const
QgsExpressionContextScope
&scope );
117
123
QgsExpressionContextScope
expressionContextScope()
const
;
124
125
private
slots:
126
void
triggerAction();
127
void
reloadActions();
128
129
signals:
130
void
reinit();
131
132
private
:
133
void
init();
134
const
QgsFeature
* feature();
135
136
QgsVectorLayer
* mLayer;
137
QgsActionManager
* mActions;
138
const
QgsFeature
* mFeature;
139
QgsFeatureId
mFeatureId;
140
bool
mOwnsFeature;
141
QgsExpressionContextScope
mExpressionContextScope;
142
};
143
144
Q_DECLARE_METATYPE
(
QgsActionMenu::ActionData
)
145
146
#endif // QGSACTIONMENU_H
QWidget
QgsMapLayer
Base class for all map layer types.
Definition:
qgsmaplayer.h:49
QgsActionMenu::ActionData::aid
Definition:
qgsactionmenu.h:67
QgsActionMenu::ActionType
ActionType
Definition:
qgsactionmenu.h:35
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(QgsMimeDataUtils::UriList)
QgsFeature
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition:
qgsfeature.h:187
QgsActionMenu::MapLayerAction
Standard actions (defined by core or plugins)
Definition:
qgsactionmenu.h:38
QgsActionMenu::ActionData::actionType
ActionType actionType
Definition:
qgsactionmenu.h:65
QgsActionMenu::ActionData::ActionData
ActionData(QgsMapLayerAction *action, QgsFeatureId featureId, QgsMapLayer *mapLayer)
Definition:
qgsactionmenu.h:58
QgsActionMenu::ActionData
Definition:
qgsactionmenu.h:42
QgsActionMenu
This class is a menu that is populated automatically with the actions defined for a given layer...
Definition:
qgsactionmenu.h:30
QgsActionManager
Storage and management of actions associated with a layer.
Definition:
qgsactionmanager.h:48
qgsmaplayeractionregistry.h
QgsExpressionContextScope
Single scope for storing variables and functions for use within a QgsExpressionContext.
Definition:
qgsexpressioncontext.h:79
QgsActionMenu::ActionData::ActionData
ActionData()
Definition:
qgsactionmenu.h:44
QgsActionMenu::ActionData::aid::action
QgsMapLayerAction * action
Definition:
qgsactionmenu.h:72
QMenu
QgsActionMenu::ActionData::aid::id
int id
Definition:
qgsactionmenu.h:71
QgsActionMenu::ActionData::aid::aid
aid(QgsMapLayerAction *a)
Definition:
qgsactionmenu.h:70
QgsActionMenu::ActionData::mapLayer
QgsMapLayer * mapLayer
Definition:
qgsactionmenu.h:76
QgsFeatureId
qint64 QgsFeatureId
Definition:
qgsfeature.h:31
QgsActionMenu::ActionData::featureId
QgsFeatureId featureId
Definition:
qgsactionmenu.h:75
QgsActionMenu::Invalid
Invalid.
Definition:
qgsactionmenu.h:37
QgsActionMenu::ActionData::aid::aid
aid(int i)
Definition:
qgsactionmenu.h:69
qgsactionmanager.h
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition:
qgsvectorlayer.h:408
QgsActionMenu::ActionData::ActionData
ActionData(int actionId, QgsFeatureId featureId, QgsMapLayer *mapLayer)
Definition:
qgsactionmenu.h:51
QgsMapLayerAction
An action which can run on map layers.
Definition:
qgsmaplayeractionregistry.h:31
Generated on Sun Jun 24 2018 11:42:48 for QGIS API Documentation by
1.8.13