19#include "moc_qgsattributedialog.cpp"
30 , mOwnedFeature( featureOwner ? thepFeature : nullptr )
32 init( vl, thepFeature, context, showDialogButtons );
48void QgsAttributeDialog::saveGeometry()
52 QgsSettings().
setValue( QStringLiteral(
"Windows/AttributeDialog/geometry" ), QDialog::saveGeometry() );
55void QgsAttributeDialog::restoreGeometry()
59 QDialog::restoreGeometry(
QgsSettings().value( QStringLiteral(
"Windows/AttributeDialog/geometry" ) ).toByteArray() );
79 if ( error.isEmpty() )
80 error = tr(
"An unknown error was encountered saving attributes" );
98 QDialog::showEvent(
event );
112 mTrackedVectorLayerTools.
rollback();
120 setWindowTitle( tr(
"%1 - Feature Attributes" ).arg( layer->
name() ) );
121 setLayout(
new QGridLayout() );
122 layout()->setContentsMargins( 0, 0, 0, 0 );
124 mMessageBar->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
125 layout()->addWidget( mMessageBar );
127 setLayout( layout() );
131 if ( showDialogButtons )
136 layout()->addWidget( mAttributeForm );
137 QDialogButtonBox *buttonBox = mAttributeForm->findChild<QDialogButtonBox *>();
140 connect( layer, &QObject::destroyed,
this, &QWidget::close );
142 mMenu =
new QgsActionMenu( layer, mAttributeForm->
feature(), QStringLiteral(
"Feature" ),
this );
146 mMenuBar =
new QMenuBar(
this );
147 mMenuBar->addMenu( mMenu );
148 layout()->setMenuBar( mMenuBar );
155 mAttributeForm->
setMode( mode );
158 if ( !mMenu->
isEmpty() && !mMenuBar )
160 mMenuBar =
new QMenuBar(
this );
161 mMenuBar->addMenu( mMenu );
162 layout()->setMenuBar( mMenuBar );
164 else if ( mMenu->
isEmpty() && mMenuBar )
166 layout()->setMenuBar(
nullptr );
174 if ( e->type() == QEvent::WindowActivate && mHighlight )
176 else if ( e->type() == QEvent::WindowDeactivate && mHighlight )
179 return QDialog::event( e );
@ Critical
Critical/error message.
void setMode(QgsAttributeEditorContext::Mode mode)
Toggles the form mode.
const QgsFeature * feature()
~QgsAttributeDialog() override
bool event(QEvent *e) override
Intercept window activate/deactivate events to show/hide the highlighted feature.
void showEvent(QShowEvent *event) override
QgsMapLayerActionContext createActionContext() override
Creates a QgsMapLayerActionContext.
void show()
Show the dialog non-blocking. Reparents this dialog to be a child of the dialog form.
void setExtraContextScope(QgsExpressionContextScope *extraScope)
Sets extraScope as an additional expression context scope to be used for calculations in this form.
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.
This class contains context information for attribute editor widgets.
const QgsVectorLayerTools * vectorLayerTools() const
Returns the associated vector layer tools.
@ StandaloneDialog
A form was opened as a new dialog.
void setFormMode(FormMode mode)
Sets the form mode.
void setVectorLayerTools(QgsVectorLayerTools *vlTools)
Sets the associated vector layer tools.
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...
A class for highlight features on the map.
Encapsulates the context in which a QgsMapLayerAction action is executed.
void setAttributeDialog(QgsAttributeDialog *dialog)
Sets the attribute dialog associated with the action's execution.
void setMessageBar(QgsMessageBar *bar)
Sets the message bar associated with the action's execution.
A bar for displaying non-blocking messages to the user.
void pushMessage(const QString &text, Qgis::MessageLevel level=Qgis::MessageLevel::Info, int duration=-1)
A convenience method for pushing a message with the specified text to the bar.
This class is a composition of two QSettings instances:
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
Represents a vector layer which manages a vector based data sets.