QGIS API Documentation 3.38.0-Grenoble (exported)
Loading...
Searching...
No Matches
qgsattributedialog.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsattributedialog.h - description
3 -------------------
4 begin : October 2004
5 copyright : (C) 2004 by Marco Hugentobler
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17#ifndef QGSATTRIBUTEDIALOG_H
18#define QGSATTRIBUTEDIALOG_H
19
21#include "qgis_sip.h"
22#include "qgsattributeform.h"
25
26#include <QDialog>
27#include <QMenuBar>
28#include <QGridLayout>
29#include "qgis_gui.h"
30
31class QgsHighlight;
32class QgsActionMenu;
33
38class GUI_EXPORT QgsAttributeDialog : public QDialog, public QgsMapLayerActionContextGenerator
39{
40 Q_OBJECT
41
42 public:
43
55 QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeature, bool featureOwner, QWidget *parent SIP_TRANSFERTHIS = nullptr, bool showDialogButtons = true, const QgsAttributeEditorContext &context = QgsAttributeEditorContext() );
56
57 ~QgsAttributeDialog() override;
58
63 void setHighlight( QgsHighlight *h );
64
65 QgsAttributeForm *attributeForm() { return mAttributeForm; }
66
67 const QgsFeature *feature() { return &mAttributeForm->feature(); }
68
74 bool editable() { return mAttributeForm->editable(); }
75
81 void setMode( QgsAttributeEditorContext::Mode mode );
82
88 void setEditCommandMessage( const QString &message ) { mAttributeForm->setEditCommandMessage( message ); }
89
97 bool event( QEvent *e ) override;
98
99 void showEvent( QShowEvent *event ) override;
100
107 void setExtraContextScope( QgsExpressionContextScope *extraScope SIP_TRANSFER );
108
110
111 public slots:
112 void accept() override;
113 void reject() override;
114
116 void show();
117
118 private:
119 void init( QgsVectorLayer *layer, QgsFeature *feature, const QgsAttributeEditorContext &context, bool showDialogButtons );
120
121 QString mSettingsPath;
122 // Used to sync multiple widgets for the same field
123 QgsHighlight *mHighlight = nullptr;
124 int mFormNr;
125 bool mShowDialogButtons;
126 QString mReturnvarname;
127 QgsAttributeForm *mAttributeForm = nullptr;
128 QgsFeature *mOwnedFeature = nullptr;
129 QgsMessageBar *mMessageBar = nullptr;
130
131 QgsTrackedVectorLayerTools mTrackedVectorLayerTools;
132
133 // true if this dialog is editable
134 bool mEditable;
135
136 QgsActionMenu *mMenu;
137 QMenuBar *mMenuBar = nullptr;
138
139 static int sFormCounter;
140
141 bool mFirstShow = true;
142 void saveGeometry();
143 void restoreGeometry();
144};
145
146#endif
This class is a menu that is populated automatically with the actions defined for a given layer.
const QgsFeature * feature()
QgsAttributeForm * attributeForm()
void setEditCommandMessage(const QString &message)
Sets the edit command message (Undo) that will be used when the dialog is accepted.
bool editable()
Is this dialog editable?
This class contains context information for attribute editor widgets.
Single scope for storing variables and functions for use within a QgsExpressionContext.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:58
A class for highlight features on the map.
An interface for objects which can create a QgsMapLayerActionContext.
virtual QgsMapLayerActionContext createActionContext()=0
Creates a QgsMapLayerActionContext.
Encapsulates the context in which a QgsMapLayerAction action is executed.
A bar for displaying non-blocking messages to the user.
Represents a vector layer which manages a vector based data sets.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_TRANSFER
Definition qgis_sip.h:36