QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
qgsattributeactiondialog.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsattributeactiondialog.h - attribute action dialog
3 -------------------
4
5This class creates and manages the Action tab of the Vector Layer
6Properties dialog box. Changes made in the dialog box are propagated
7back to QgsVectorLayer.
8
9 begin : October 2004
10 copyright : (C) 2004 by Gavin Macaulay
11 email : gavin at macaulay dot co dot nz
12 ***************************************************************************/
13
14/***************************************************************************
15 * *
16 * This program is free software; you can redistribute it and/or modify *
17 * it under the terms of the GNU General Public License as published by *
18 * the Free Software Foundation; either version 2 of the License, or *
19 * (at your option) any later version. *
20 * *
21 ***************************************************************************/
22
23#ifndef QGSATTRIBUTEACTIONDIALOG_H
24#define QGSATTRIBUTEACTIONDIALOG_H
25
26// We don't want to expose this in the public API
27#define SIP_NO_FILE
28
29#include "ui_qgsattributeactiondialogbase.h"
31#include "qgis_gui.h"
32#include "qgis.h"
33
34#include <QMap>
35
37class QgsVectorLayer;
38class QgsAction;
39
44class GUI_EXPORT QgsAttributeActionDialog: public QWidget, private Ui::QgsAttributeActionDialogBase
45{
46 Q_OBJECT
47 private:
48 enum ColumnIndexes
49 {
50 Type,
51 Description,
52 ShortTitle,
53 ActionText,
54 Capture,
55 ActionScopes,
56 NotificationMessage,
57 EnabledOnlyWhenEditable
58 };
59
61 enum Role
62 {
63 ActionType = Qt::UserRole,
64 ActionId = Qt::UserRole + 1
65 };
66
67 public:
69 QWidget *parent = nullptr );
70
71 void init( const QgsActionManager &action, const QgsAttributeTableConfig &attributeTableConfig );
72
73 QList<QgsAction> actions() const;
74
75 bool showWidgetInAttributeTable() const;
76
77 QgsAttributeTableConfig::ActionWidgetStyle attributeTableWidgetStyle() const;
78
79 private slots:
80 void moveUp();
81 void moveDown();
82 void remove();
83 void insert();
84 void duplicate();
85 void addDefaultActions();
86 void itemDoubleClicked( QTableWidgetItem *item );
87 void updateButtons();
88
89 private:
90 void insertRow( int row, const QgsAction &action );
91 void insertRow( int row, Qgis::AttributeActionType type, const QString &name, const QString &actionText, const QString &iconPath, bool capture, const QString &shortTitle, const QSet<QString> &actionScopes, const QString &notificationMessage, bool isEnabledOnlyWhenEditable = false );
92 void swapRows( int row1, int row2 );
93 QgsAction rowToAction( int row ) const;
94
95 QString textForType( Qgis::AttributeActionType type );
96
97 void rowSelected( int row );
98
99 QString uniqueName( QString name );
100
101 QgsVectorLayer *mLayer = nullptr;
102};
103
104#endif
AttributeActionType
Attribute action types.
Definition qgis.h:4331
Storage and management of actions associated with a layer.
Utility class that encapsulates an action based on vector attributes.
Definition qgsaction.h:37
This is a container for configuration of the attribute table.
ActionWidgetStyle
The style of the action widget in the attribute table.
Represents a vector layer which manages a vector based data sets.