QGIS API Documentation  2.12.0-Lyon
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 
20 #include "qgsfeature.h"
22 #include "qgsattributeform.h"
23 
24 #include <QDialog>
25 #include <QMenuBar>
26 #include <QGridLayout>
27 
28 class QgsDistanceArea;
29 class QgsFeature;
30 class QgsField;
31 class QgsHighlight;
32 class QgsVectorLayer;
34 
35 class GUI_EXPORT QgsAttributeDialog : public QDialog
36 {
37  Q_OBJECT
38 
39  public:
52  QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeature, bool featureOwner, const QgsDistanceArea& myDa, QWidget* parent = 0, bool showDialogButtons = true );
53 
65  QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeature, bool featureOwner, QWidget* parent = 0, bool showDialogButtons = true, const QgsAttributeEditorContext& context = QgsAttributeEditorContext() );
66 
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 
112  void setIsAddDialog( bool isAddDialog ) { mAttributeForm->setIsAddDialog( isAddDialog ); }
113 
119  void setEditCommandMessage( const QString& message ) { mAttributeForm->setEditCommandMessage( message ); }
120 
121  public slots:
122  void accept() override;
123 
126  void show( bool autoDelete = true );
127 
128  private:
129  void init( QgsVectorLayer* layer, QgsFeature* feature, const QgsAttributeEditorContext& context, QWidget* parent );
130 
131  QString mSettingsPath;
132  // Used to sync multiple widgets for the same field
133  QgsHighlight *mHighlight;
134  int mFormNr;
135  bool mShowDialogButtons;
136  QString mReturnvarname;
137  QgsAttributeForm* mAttributeForm;
138  QgsFeature *mOwnedFeature;
139 
140  // true if this dialog is editable
141  bool mEditable;
142 
143  static int sFormCounter;
144  static QString sSettingsPath;
145 };
146 
147 #endif
Methods in this class are used to handle basic operations on vector layers.
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:176
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:36
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:40
virtual void accept()
QgsAttributeForm * attributeForm()
void setIsAddDialog(bool isAddDialog)
Toggles the form mode between edit feature and add feature.
General purpose distance and area calculator.
QByteArray saveGeometry() const
const QgsFeature * feature()
void show()
Represents a vector layer which manages a vector based data sets.