QGIS API Documentation
2.8.2-Wien
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
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 dot kuhn at gmx 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 "
qgsattributeaction.h
"
23
#include "
qgsmaplayeractionregistry.h
"
24
25
30
class
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
( NULL )
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
79
80
public
:
89
explicit
QgsActionMenu
(
QgsVectorLayer
* layer,
const
QgsFeature
* feature, QWidget* parent = 0 );
90
98
explicit
QgsActionMenu
(
QgsVectorLayer
* layer,
const
QgsFeatureId
fid, QWidget* parent = 0 );
99
103
~QgsActionMenu
();
104
111
void
setFeature
(
QgsFeature
* feature );
112
117
void
setFeature
(
QgsFeatureId
feature );
118
119
private
slots:
120
void
triggerAction();
121
void
reloadActions();
122
123
signals:
124
void
reinit
();
125
126
private
:
127
void
init();
128
const
QgsFeature
* feature();
129
130
QgsVectorLayer
* mLayer;
131
QgsAttributeAction
* mActions;
132
const
QgsFeature
* mFeature;
133
QgsFeatureId
mFeatureId;
134
bool
mOwnsFeature;
135
};
136
137
Q_DECLARE_METATYPE
(
QgsActionMenu::ActionData
)
138
139
#endif // QGSACTIONMENU_H
Generated on Sun May 10 2015 16:33:25 for QGIS API Documentation by
1.8.1.2