QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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