QGIS API Documentation  2.99.0-Master (b8fd1fd)
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
6  email : [email protected]
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 "qgsattributeform.h"
23 
24 #include <QDialog>
25 #include <QMenuBar>
26 #include <QGridLayout>
27 #include "qgis_gui.h"
28 
29 class QgsDistanceArea;
30 class QgsHighlight;
31 
35 class GUI_EXPORT QgsAttributeDialog : public QDialog
36 {
37  Q_OBJECT
38 
39  public:
40 
52  QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeature, bool featureOwner, QWidget *parent = nullptr, bool showDialogButtons = true, const QgsAttributeEditorContext &context = QgsAttributeEditorContext() );
53 
55 
59  void saveGeometry();
60 
64  void restoreGeometry();
65 
70  void setHighlight( QgsHighlight *h );
71 
72  QgsAttributeForm *attributeForm() { return mAttributeForm; }
73 
74  const QgsFeature *feature() { return &mAttributeForm->feature(); }
75 
81  bool editable() { return mAttributeForm->editable(); }
82 
88  void setMode( QgsAttributeForm::Mode mode ) { mAttributeForm->setMode( mode ); }
89 
95  void setEditCommandMessage( const QString &message ) { mAttributeForm->setEditCommandMessage( message ); }
96 
104  virtual bool event( QEvent *e ) override;
105 
106  public slots:
107  void accept() override;
108  void reject() override;
109 
111  void show();
112 
113  private:
114  void init( QgsVectorLayer *layer, QgsFeature *feature, const QgsAttributeEditorContext &context, bool showDialogButtons );
115 
116  QString mSettingsPath;
117  // Used to sync multiple widgets for the same field
118  QgsHighlight *mHighlight = nullptr;
119  int mFormNr;
120  bool mShowDialogButtons;
121  QString mReturnvarname;
122  QgsAttributeForm *mAttributeForm = nullptr;
123  QgsFeature *mOwnedFeature = nullptr;
124 
125  QgsTrackedVectorLayerTools mTrackedVectorLayerTools;
126 
127  // true if this dialog is editable
128  bool mEditable;
129 
130  static int sFormCounter;
131  static QString sSettingsPath;
132 
133 };
134 
135 #endif
This class contains context information for attribute editor widgets.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:136
bool editable()
Is this dialog editable?
void setEditCommandMessage(const QString &message)
Sets the edit command message (Undo) that will be used when the dialog is accepted.
A class for highlight features on the map.
Definition: qgshighlight.h:36
QgsAttributeForm * attributeForm()
General purpose distance and area calculator.
const QgsFeature * feature()
void setMode(QgsAttributeForm::Mode mode)
Toggles the form mode.
Represents a vector layer which manages a vector based data sets.