QGIS API Documentation
3.41.0-Master (d5b93354e9c)
Loading...
Searching...
No Matches
src
gui
actions
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 "
qgis_sip.h
"
21
22
#include "
qgsfeature.h
"
23
#include "
qgsattributeeditorcontext.h
"
24
#include "
qgsaction.h
"
25
#include "qgis_gui.h"
26
27
class
QgsMapLayer
;
28
class
QgsMapLayerAction
;
29
class
QgsVectorLayer
;
30
class
QgsActionManager
;
31
class
QgsMapLayerActionContextGenerator
;
32
38
class
GUI_EXPORT
QgsActionMenu
:
public
QMenu
39
{
40
Q_OBJECT
41
42
public
:
43
struct
GUI_EXPORT
ActionData
44
{
45
ActionData
() =
default
;
46
ActionData
(
const
QgsAction
&action,
QgsFeatureId
featureId,
QgsMapLayer
*mapLayer );
47
ActionData
(
QgsMapLayerAction
*action,
QgsFeatureId
featureId,
QgsMapLayer
*mapLayer );
48
49
Qgis::ActionType
actionType =
Qgis::ActionType::Invalid
;
50
QVariant
actionData
;
51
QgsFeatureId
featureId = 0;
52
QgsMapLayer
*mapLayer =
nullptr
;
53
};
54
64
explicit
QgsActionMenu
(
QgsVectorLayer
*layer,
const
QgsFeature
&feature,
const
QString &actionScope, QWidget *parent
SIP_TRANSFERTHIS
=
nullptr
);
65
74
explicit
QgsActionMenu
(
QgsVectorLayer
*layer,
QgsFeatureId
fid,
const
QString &actionScope, QWidget *parent
SIP_TRANSFERTHIS
=
nullptr
);
75
83
void
setActionContextGenerator(
QgsMapLayerActionContextGenerator
*generator );
84
91
void
setFeature(
const
QgsFeature
&feature );
92
98
void
setMode(
QgsAttributeEditorContext::Mode
mode );
99
104
void
setExpressionContextScope(
const
QgsExpressionContextScope
&scope );
105
110
QgsExpressionContextScope
expressionContextScope()
const
;
111
117
QList<QgsAction> menuActions();
118
124
bool
isEmpty()
const
;
125
126
signals:
127
131
void
reinit
();
132
133
private
slots:
134
void
triggerAction();
135
void
reloadActions();
136
void
layerWillBeDeleted();
137
138
private
:
139
void
init();
140
QgsFeature
feature();
141
142
QgsVectorLayer
*mLayer =
nullptr
;
143
int
mVisibleActionCount = 0;
144
QList<QgsAction> mActions;
145
QgsFeature
mFeature;
146
QgsFeatureId
mFeatureId;
147
QString mActionScope;
148
QgsExpressionContextScope
mExpressionContextScope;
149
QgsAttributeEditorContext::Mode
mMode =
QgsAttributeEditorContext::SingleEditMode
;
150
151
QgsMapLayerActionContextGenerator
*mContextGenerator =
nullptr
;
152
};
153
154
155
Q_DECLARE_METATYPE
(
QgsActionMenu::ActionData
)
156
157
#endif
// QGSACTIONMENU_H
Qgis::ActionType
ActionType
Action types.
Definition
qgis.h:4320
Qgis::ActionType::Invalid
@ Invalid
Invalid.
QgsActionManager
Storage and management of actions associated with a layer.
Definition
qgsactionmanager.h:52
QgsActionMenu
This class is a menu that is populated automatically with the actions defined for a given layer.
Definition
qgsactionmenu.h:39
QgsActionMenu::reinit
void reinit()
Emitted after actions have been reloaded.
QgsAction
Utility class that encapsulates an action based on vector attributes.
Definition
qgsaction.h:37
QgsAttributeEditorContext::Mode
Mode
modes
Definition
qgsattributeeditorcontext.h:47
QgsAttributeEditorContext::SingleEditMode
@ SingleEditMode
Single edit mode, for editing a single feature.
Definition
qgsattributeeditorcontext.h:48
QgsExpressionContextScope
Single scope for storing variables and functions for use within a QgsExpressionContext.
Definition
qgsexpressioncontext.h:115
QgsFeature
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition
qgsfeature.h:58
QgsMapLayerActionContextGenerator
An interface for objects which can create a QgsMapLayerActionContext.
Definition
qgsmaplayeractioncontextgenerator.h:32
QgsMapLayerAction
An action which can run on map layers The class can be used in two manners:
Definition
qgsmaplayeraction.h:42
QgsMapLayer
Base class for all map layer types.
Definition
qgsmaplayer.h:76
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition
qgsvectorlayer.h:401
qgis_sip.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:53
qgsaction.h
qgsattributeeditorcontext.h
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
qgsfeature.h
QgsFeatureId
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
Definition
qgsfeatureid.h:28
QgsActionMenu::ActionData
Definition
qgsactionmenu.h:44
QgsActionMenu::ActionData::ActionData
ActionData()=default
QgsActionMenu::ActionData::actionData
QVariant actionData
Definition
qgsactionmenu.h:50
Generated on Sat Dec 7 2024 03:46:51 for QGIS API Documentation by
1.9.8