QGIS API Documentation  2.5.0-Master
 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 : 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"
23 
24 #include <QDialog>
25 #include <QPointer>
26 
27 class QLayout;
28 
29 class QgsDistanceArea;
30 class QgsFeature;
31 class QgsField;
32 class QgsHighlight;
33 class QgsVectorLayer;
35 
36 class GUI_EXPORT QgsAttributeDialog : public QObject
37 {
38  Q_OBJECT
39 
40  public:
53  QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeature, bool featureOwner, QgsDistanceArea myDa, QWidget* parent = 0, bool showDialogButtons = true );
54 
66  QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeature, bool featureOwner, QWidget* parent = 0, bool showDialogButtons = true, QgsAttributeEditorContext context = QgsAttributeEditorContext() );
67 
69 
73  void saveGeometry();
74 
78  void restoreGeometry();
79 
84  void setHighlight( QgsHighlight *h );
85 
86  QDialog *dialog() { return mDialog; }
87 
88  QgsAttributeForm* attributeForm() { return mAttributeForm; }
89 
90  const QgsFeature* feature() { return &mAttributeForm->feature(); }
91 
97  bool editable() { return mAttributeForm->editable(); }
98 
106  void setIsAddDialog( bool isAddDialog ) { mAttributeForm->setIsAddDialog( isAddDialog ); }
107 
113  void setEditCommandMessage( const QString& message ) { mAttributeForm->setEditCommandMessage( message ); }
114 
115  public slots:
116  void accept();
117 
119  int exec();
120 
123  void show();
124 
125  protected:
126  bool eventFilter( QObject *obj, QEvent *e );
127 
128  private slots:
129  void onDialogFinished( int result );
130 
131  private:
132  void init( QgsVectorLayer* layer, QgsFeature* feature, QgsAttributeEditorContext& context, QWidget* parent );
133 
134  // Using a guarded pointer we can savely delete the dialog in the destructor even
135  // when the dialog is this object's parent
136  QPointer<QDialog> mDialog;
137  QString mSettingsPath;
138  // Used to sync multiple widgets for the same field
140  int mFormNr;
142  QString mReturnvarname;
144 
145  // true if this dialog is editable
146  bool mEditable;
147 
148  static int sFormCounter;
149  static QString sSettingsPath;
150 };
151 
152 #endif
Methods in this class are used to handle basic operations on vector layers.
QgsAttributeForm * mAttributeForm
This class contains context information for attribute editor widgets.
QgsHighlight * mHighlight
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:113
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:36
static QString sSettingsPath
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:31
QgsAttributeForm * attributeForm()
void setIsAddDialog(bool isAddDialog)
Toggles the form mode between edit feature and add feature.
QPointer< QDialog > mDialog
General purpose distance and area calculator.
const QgsFeature * feature()
Represents a vector layer which manages a vector based data sets.