QGIS API Documentation  2.99.0-Master (69af2f5)
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 "qgis.h"
22 #include "qgsattributeform.h"
24 
25 #include <QDialog>
26 #include <QMenuBar>
27 #include <QGridLayout>
28 #include "qgis_gui.h"
29 
30 class QgsDistanceArea;
31 class QgsHighlight;
32 
36 class GUI_EXPORT QgsAttributeDialog : public QDialog
37 {
38  Q_OBJECT
39 
40  public:
41 
53  QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeature, bool featureOwner, QWidget *parent SIP_TRANSFERTHIS = 0, bool showDialogButtons = true, const QgsAttributeEditorContext &context = QgsAttributeEditorContext() );
54 
56 
60  void saveGeometry();
61 
65  void restoreGeometry();
66 
71  void setHighlight( QgsHighlight *h );
72 
73  QgsAttributeForm *attributeForm() { return mAttributeForm; }
74 
75  const QgsFeature *feature() { return &mAttributeForm->feature(); }
76 
82  bool editable() { return mAttributeForm->editable(); }
83 
89  void setMode( QgsAttributeForm::Mode mode ) { mAttributeForm->setMode( mode ); }
90 
96  void setEditCommandMessage( const QString &message ) { mAttributeForm->setEditCommandMessage( message ); }
97 
105  virtual bool event( QEvent *e ) override;
106 
107  public slots:
108  void accept() override;
109  void reject() override;
110 
112  void show();
113 
114  private:
115  void init( QgsVectorLayer *layer, QgsFeature *feature, const QgsAttributeEditorContext &context, bool showDialogButtons );
116 
117  QString mSettingsPath;
118  // Used to sync multiple widgets for the same field
119  QgsHighlight *mHighlight = nullptr;
120  int mFormNr;
121  bool mShowDialogButtons;
122  QString mReturnvarname;
123  QgsAttributeForm *mAttributeForm = nullptr;
124  QgsFeature *mOwnedFeature = nullptr;
125 
126  QgsTrackedVectorLayerTools mTrackedVectorLayerTools;
127 
128  // true if this dialog is editable
129  bool mEditable;
130 
131  static int sFormCounter;
132  static QString sSettingsPath;
133 
134 };
135 
136 #endif
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:34
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:61
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:39
QgsAttributeForm * attributeForm()
A general purpose distance and area calculator, capable of performing ellipsoid based calculations...
const QgsFeature * feature()
void setMode(QgsAttributeForm::Mode mode)
Toggles the form mode.
Represents a vector layer which manages a vector based data sets.