QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
28 , mOwnedFeature( featureOwner ? thepFeature : nullptr )
30 init( vl, thepFeature, context, showDialogButtons );
46 void QgsAttributeDialog::saveGeometry()
53 void QgsAttributeDialog::restoreGeometry()
69 bool didSave = mAttributeForm->
save();
77 tr(
"Your JSON value is invalid and has not been saved" ),
78 Qgis::MessageLevel::Critical,
102 setWindowTitle( tr(
"%1 - Feature Attributes" ).arg( layer->
name() ) );
103 setLayout(
new QGridLayout() );
104 layout()->setContentsMargins( 0, 0, 0, 0 );
106 mMessageBar->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
107 layout()->addWidget( mMessageBar );
109 setLayout( layout() );
113 if ( showDialogButtons )
118 layout()->addWidget( mAttributeForm );
119 QDialogButtonBox *buttonBox = mAttributeForm->findChild<QDialogButtonBox *>();
122 connect( layer, &QObject::destroyed,
this, &QWidget::close );
124 mMenu =
new QgsActionMenu( layer, mAttributeForm->
feature(), QStringLiteral(
"Feature" ),
this );
127 QMenuBar *menuBar =
new QMenuBar(
this );
128 menuBar->addMenu( mMenu );
129 layout()->setMenuBar( menuBar );
138 mAttributeForm->
setMode( mode );
144 if ( e->type() == QEvent::WindowActivate && mHighlight )
146 else if ( e->type() == QEvent::WindowDeactivate && mHighlight )
149 return QDialog::event( e );
void setHighlight(QgsHighlight *h)
setHighlight
void setFormMode(FormMode mode)
Sets the form mode.
This class is a composition of two QSettings instances:
void saveGeometry(QWidget *widget, const QString &keyName)
Save the wigget geometry into settings.
bool restoreGeometry(QWidget *widget, const QString &keyName)
Restore the wigget geometry from settings.
const QgsFeature * feature()
void setMode(QgsAttributeEditorContext::Mode mode)
Toggles the form mode.
A class for highlight features on the map.
@ StandaloneDialog
A form was opened as a new dialog.
A bar for displaying non-blocking messages to the user.
void show()
Show the dialog non-blocking. Reparents this dialog to be a child of the dialog form.
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.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
void setVectorLayerTools(QgsVectorLayerTools *vlTools)
Sets the associated vector layer tools.
void setExtraContextScope(QgsExpressionContextScope *extraScope)
Sets extraScope as an additional expression context scope to be used for calculations in this form.
Single scope for storing variables and functions for use within a QgsExpressionContext.
~QgsAttributeDialog() override
Represents a vector layer which manages a vector based data sets.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
This class contains context information for attribute editor widgets.
bool event(QEvent *e) override
Intercept window activate/deactivate events to show/hide the highlighted feature.
const QgsVectorLayerTools * vectorLayerTools() const
Returns the associated vector layer tools.
void pushMessage(const QString &text, Qgis::MessageLevel level=Qgis::Info, int duration=5)
A convenience method for pushing a message with the specified text to the bar.