QGIS API Documentation  2.6.0-Brighton
 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, QgsDistanceArea myDa, QWidget* parent = 0, bool showDialogButtons = true );
53 
65  QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeature, bool featureOwner, QWidget* parent = 0, bool showDialogButtons = true, 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();
123 
126  void show( bool autoDelete = true );
127 
128  private:
129  void init( QgsVectorLayer* layer, QgsFeature* feature, 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  QMenuBar* mMenuBar;
139  QgsFeature *mOwnedFeature;
140 
141  // true if this dialog is editable
142  bool mEditable;
143 
144  static int sFormCounter;
145  static QString sSettingsPath;
146 };
147 
148 #endif