QGIS API Documentation  2.17.0-Master (973e4b0)
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 : marco.hugentobler@autoform.ch
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 "qgsfeature.h"
22 #include "qgsattributeform.h"
24 
25 #include <QDialog>
26 #include <QMenuBar>
27 #include <QGridLayout>
28 
29 class QgsDistanceArea;
30 class QgsHighlight;
31 
35 class GUI_EXPORT QgsAttributeDialog : public QDialog
36 {
37  Q_OBJECT
38 
39  public:
52  Q_DECL_DEPRECATED QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeature, bool featureOwner, const QgsDistanceArea& myDa, QWidget* parent = nullptr, bool showDialogButtons = true );
53 
65  QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeature, bool featureOwner, QWidget* parent = nullptr, bool showDialogButtons = true, const QgsAttributeEditorContext& context = QgsAttributeEditorContext() );
66 
67  ~QgsAttributeDialog();
68 
72  void saveGeometry();
73 
77  void restoreGeometry();
78 
83  void setHighlight( QgsHighlight *h );
84 
92  Q_DECL_DEPRECATED QDialog *dialog() { return this; }
93 
94  QgsAttributeForm *attributeForm() { return mAttributeForm; }
95 
96  const QgsFeature *feature() { return &mAttributeForm->feature(); }
97 
103  bool editable() { return mAttributeForm->editable(); }
104 
113  Q_DECL_DEPRECATED void setIsAddDialog( bool isAddDialog ) { mAttributeForm->setMode( isAddDialog ? QgsAttributeForm::AddFeatureMode : QgsAttributeForm::SingleEditMode ); }
114 
120  void setMode( QgsAttributeForm::Mode mode ) { mAttributeForm->setMode( mode ); }
121 
127  void setEditCommandMessage( const QString& message ) { mAttributeForm->setEditCommandMessage( message ); }
128 
136  virtual bool event( QEvent *e ) override;
137 
138  public slots:
139  void accept() override;
140  void reject() override;
141 
144  void show( bool autoDelete = true );
145 
146  private:
147  void init( QgsVectorLayer* layer, QgsFeature* feature, const QgsAttributeEditorContext& context, bool showDialogButtons );
148 
149  QString mSettingsPath;
150  // Used to sync multiple widgets for the same field
151  QgsHighlight *mHighlight;
152  int mFormNr;
153  bool mShowDialogButtons;
154  QString mReturnvarname;
155  QgsAttributeForm* mAttributeForm;
156  QgsFeature *mOwnedFeature;
157 
158  QgsTrackedVectorLayerTools mTrackedVectorLayerTools;
159 
160  // true if this dialog is editable
161  bool mEditable;
162 
163  static int sFormCounter;
164  static QString sSettingsPath;
165 
166 };
167 
168 #endif
virtual bool event(QEvent *e)
virtual void reject()
Q_DECL_DEPRECATED void setIsAddDialog(bool isAddDialog)
Toggles the form mode between edit feature and add feature.
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:187
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.
Q_DECL_DEPRECATED QDialog * dialog()
Returns reference to self.
bool restoreGeometry(const QByteArray &geometry)
A class for highlight features on the map.
Definition: qgshighlight.h:37
virtual void accept()
QgsAttributeForm * attributeForm()
General purpose distance and area calculator.
QByteArray saveGeometry() const
const QgsFeature * feature()
void show()
void setMode(QgsAttributeForm::Mode mode)
Toggles the form mode.
Represents a vector layer which manages a vector based data sets.