QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsattributeactiondialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsattributeactiondialog.h - attribute action dialog
3  -------------------
4 
5 This class creates and manages the Action tab of the Vector Layer
6 Properties dialog box. Changes made in the dialog box are propagated
7 back 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 
35 class QgsActionManager;
36 class QgsVectorLayer;
37 
42 class 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
QgsAttributeTableConfig::ActionWidgetStyle
ActionWidgetStyle
The style of the action widget in the attribute table.
Definition: qgsattributetableconfig.h:76
QgsAttributeTableConfig
This is a container for configuration of the attribute table. The configuration is specific for one v...
Definition: qgsattributetableconfig.h:36
QgsAttributeActionDialog
Definition: qgsattributeactiondialog.h:42
qgsaction.h
QgsAction::ActionType
ActionType
Definition: qgsaction.h:37
QgsAction
Utility class that encapsulates an action based on vector attributes.
Definition: qgsaction.h:34
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:391
qgsattributetableconfig.h
QgsActionManager
Storage and management of actions associated with a layer.
Definition: qgsactionmanager.h:52