QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
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 "qgsaction.h"
32#include <QMap>
33#include "qgis_gui.h"
34
36class QgsVectorLayer;
37
42class GUI_EXPORT QgsAttributeActionDialog: public QWidget, private Ui::QgsAttributeActionDialogBase
43{
44 Q_OBJECT
45 private:
46 enum ColumnIndexes
47 {
48 Type,
49 Description,
50 ShortTitle,
51 ActionText,
52 Capture,
53 ActionScopes,
54 NotificationMessage,
55 EnabledOnlyWhenEditable
56 };
57
59 enum Role
60 {
61 ActionType = Qt::UserRole,
62 ActionId = Qt::UserRole + 1
63 };
64
65 public:
67 QWidget *parent = nullptr );
68
69 void init( const QgsActionManager &action, const QgsAttributeTableConfig &attributeTableConfig );
70
71 QList<QgsAction> actions() const;
72
73 bool showWidgetInAttributeTable() const;
74
75 QgsAttributeTableConfig::ActionWidgetStyle attributeTableWidgetStyle() const;
76
77 private slots:
78 void moveUp();
79 void moveDown();
80 void remove();
81 void insert();
82 void addDefaultActions();
83 void itemDoubleClicked( QTableWidgetItem *item );
84 void updateButtons();
85
86 private:
87 void insertRow( int row, const QgsAction &action );
88 void insertRow( int row, QgsAction::ActionType 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 );
89 void swapRows( int row1, int row2 );
90 QgsAction rowToAction( int row ) const;
91
92 QString textForType( QgsAction::ActionType type );
93
94 void rowSelected( int row );
95
96 QString uniqueName( QString name );
97
98 QgsVectorLayer *mLayer = nullptr;
99};
100
101#endif
Storage and management of actions associated with a layer.
Utility class that encapsulates an action based on vector attributes.
Definition: qgsaction.h:35
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.