QGIS API Documentation 4.1.0-Master (5bf3c20f3c9)
Loading...
Searching...
No Matches
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
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 "qgis_gui.h"
21#include "qgis_sip.h"
23#include "qgsattributeform.h"
26
27#include <QDialog>
28#include <QGridLayout>
29#include <QMenuBar>
30
31class QgsHighlight;
32class QgsActionMenu;
33
39class GUI_EXPORT QgsAttributeDialog : public QDialog, public QgsMapLayerActionContextGenerator
40{
41 Q_OBJECT
42
43 public:
57 QgsFeature *thepFeature,
58 bool featureOwner,
59 QWidget *parent SIP_TRANSFERTHIS = nullptr,
60 bool showDialogButtons = true,
62 );
63
64 ~QgsAttributeDialog() override;
65
70 void setHighlight( QgsHighlight *h );
71
75 QgsAttributeForm *attributeForm() const { return mAttributeForm; }
76
80 const QgsFeature *feature() const { return &mAttributeForm->feature(); }
81
87 bool editable() const { return mAttributeForm->editable(); }
88
94 void setMode( QgsAttributeEditorContext::Mode mode );
95
101 void setEditCommandMessage( const QString &message ) { mAttributeForm->setEditCommandMessage( message ); }
102
110 bool event( QEvent *e ) override;
111
112 void showEvent( QShowEvent *event ) override;
113
120 void setExtraContextScope( QgsExpressionContextScope *extraScope SIP_TRANSFER );
121
123
124 public slots:
125 void accept() override;
126 void reject() override;
127
129 void show();
130
131 private:
132 void init( QgsVectorLayer *layer, QgsFeature *feature, const QgsAttributeEditorContext &context, bool showDialogButtons );
133
134 QString mSettingsPath;
135 // Used to sync multiple widgets for the same field
136 QgsHighlight *mHighlight = nullptr;
137 QString mReturnvarname;
138 QgsAttributeForm *mAttributeForm = nullptr;
139 QgsFeature *mOwnedFeature = nullptr;
140 QgsMessageBar *mMessageBar = nullptr;
141
142 QgsTrackedVectorLayerTools mTrackedVectorLayerTools;
143
144 QgsActionMenu *mMenu;
145 QMenuBar *mMenuBar = nullptr;
146
147 static int sFormCounter;
148
149 bool mFirstShow = true;
150 void saveGeometry();
151 void restoreGeometry();
152};
153
154#endif
A menu that is populated automatically with the actions defined for a given layer.
QgsAttributeForm * attributeForm() const
Returns the attribute form.
const QgsFeature * feature() const
Returns the current feature of the attribute form.
void setEditCommandMessage(const QString &message)
Sets the edit command message (Undo) that will be used when the dialog is accepted.
bool editable() const
Is this dialog editable?
void setHighlight(QgsHighlight *h)
setHighlight
QgsAttributeDialog(QgsVectorLayer *vl, QgsFeature *thepFeature, bool featureOwner, QWidget *parent=nullptr, bool showDialogButtons=true, const QgsAttributeEditorContext &context=QgsAttributeEditorContext())
Create an attribute dialog for a given layer and feature.
Contains context information for attribute editor widgets.
The attribute form widget for vector layer features.
Single scope for storing variables and functions for use within a QgsExpressionContext.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:60
Highlights features on the map.
An interface for objects which can create a QgsMapLayerActionContext.
virtual QgsMapLayerActionContext createActionContext()=0
Creates a QgsMapLayerActionContext.
Encapsulates the context in which a QgsMapLayerAction action is executed.
A bar for displaying non-blocking messages to the user.
Vector layer tools subclass which "tracks" edits.
Represents a vector layer which manages a vector based dataset.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52
#define SIP_TRANSFER
Definition qgis_sip.h:35