QGIS API Documentation
2.6.0-Brighton
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
{}
48
49
ActionData
(
int
actionId
,
QgsFeatureId
featureId
,
QgsMapLayer
*
mapLayer
)
50
:
actionType
(
AttributeAction
)
51
, actionId( actionId )
52
, featureId( featureId )
53
, mapLayer( mapLayer )
54
{}
55
56
ActionData
(
QgsMapLayerAction
* action,
QgsFeatureId
featureId
,
QgsMapLayer
*
mapLayer
)
57
:
actionType
(
MapLayerAction
)
58
,
actionId
( action )
59
, featureId( featureId )
60
, mapLayer( mapLayer )
61
{}
62
63
ActionType
actionType
;
64
65
union
aid
66
{
67
aid
(
int
i ) :
id
( i ) {}
68
aid
(
QgsMapLayerAction
* a ) :
action
( a ) {}
69
int
id
;
70
QgsMapLayerAction
*
action
;
71
}
actionId
;
72
73
QgsFeatureId
featureId
;
74
QgsMapLayer
*
mapLayer
;
75
};
76
77
78
public
:
87
explicit
QgsActionMenu
(
QgsVectorLayer
* layer,
const
QgsFeature
* feature, QWidget* parent = 0 );
88
96
explicit
QgsActionMenu
(
QgsVectorLayer
* layer,
const
QgsFeatureId
fid, QWidget* parent = 0 );
97
101
~QgsActionMenu
();
102
109
void
setFeature
(
QgsFeature
* feature );
110
115
void
setFeature
(
QgsFeatureId
feature );
116
117
private
slots:
118
void
triggerAction();
119
void
reloadActions();
120
121
signals:
122
void
reinit
();
123
124
private
:
125
void
init();
126
const
QgsFeature
* feature();
127
128
QgsVectorLayer
* mLayer;
129
QgsAttributeAction
* mActions;
130
const
QgsFeature
* mFeature;
131
QgsFeatureId
mFeatureId;
132
bool
mOwnsFeature;
133
};
134
135
Q_DECLARE_METATYPE
(
QgsActionMenu::ActionData
)
136
137
#endif // QGSACTIONMENU_H
Generated on Fri Oct 31 2014 15:49:46 for QGIS API Documentation by
1.8.1.2