QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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
20#include "qgis_gui.h"
21#include "qgis_sip.h"
23#include "qgsattributeform.h"
26
27#include <QDialog>
28#include <QGridLayout>
29#include <QMenuBar>
30
31class QgsHighlight;
32class QgsActionMenu;
33
39class GUI_EXPORT QgsAttributeDialog : public QDialog, public QgsMapLayerActionContextGenerator
40{
41 Q_OBJECT
42
43 public:
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
68 QgsAttributeForm *attributeForm() const { return mAttributeForm; }
69
73 const QgsFeature *feature() const { return &mAttributeForm->feature(); }
74
80 bool editable() const { return mAttributeForm->editable(); }
81
87 void setMode( QgsAttributeEditorContext::Mode mode );
88
94 void setEditCommandMessage( const QString &message ) { mAttributeForm->setEditCommandMessage( message ); }
95
103 bool event( QEvent *e ) override;
104
105 void showEvent( QShowEvent *event ) override;
106
113 void setExtraContextScope( QgsExpressionContextScope *extraScope SIP_TRANSFER );
114
116
117 public slots:
118 void accept() override;
119 void reject() override;
120
122 void show();
123
124 private:
125 void init( QgsVectorLayer *layer, QgsFeature *feature, const QgsAttributeEditorContext &context, bool showDialogButtons );
126
127 QString mSettingsPath;
128 // Used to sync multiple widgets for the same field
129 QgsHighlight *mHighlight = nullptr;
130 QString mReturnvarname;
131 QgsAttributeForm *mAttributeForm = nullptr;
132 QgsFeature *mOwnedFeature = nullptr;
133 QgsMessageBar *mMessageBar = nullptr;
134
135 QgsTrackedVectorLayerTools mTrackedVectorLayerTools;
136
137 QgsActionMenu *mMenu;
138 QMenuBar *mMenuBar = nullptr;
139
140 static int sFormCounter;
141
142 bool mFirstShow = true;
143 void saveGeometry();
144 void restoreGeometry();
145};
146
147#endif
A menu that is populated automatically with the actions defined for a given layer.
QgsAttributeForm * attributeForm() const
Returns the attribute form.
const QgsFeature * feature() const
Returns the current feature of the attribute form.
void setEditCommandMessage(const QString &message)
Sets the edit command message (Undo) that will be used when the dialog is accepted.
bool editable() const
Is this dialog editable?
void setHighlight(QgsHighlight *h)
setHighlight
QgsAttributeDialog(QgsVectorLayer *vl, QgsFeature *thepFeature, bool featureOwner, QWidget *parent=nullptr, bool showDialogButtons=true, const QgsAttributeEditorContext &context=QgsAttributeEditorContext())
Create an attribute dialog for a given layer and feature.
Contains context information for attribute editor widgets.
The attribute form widget for vector layer features.
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
Highlights 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.
Vector layer tools subclass which "tracks" edits.
Represents a vector layer which manages a vector based dataset.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_TRANSFER
Definition qgis_sip.h:36