16#ifndef QGSATTRIBUTEFORM_H
17#define QGSATTRIBUTEFORM_H
27#include <QDialogButtonBox>
95 void displayWarning(
const QString &message );
103 void hideButtonBox();
111 void showButtonBox();
119 void disconnectButtonBox();
171 bool eventFilter( QObject *
object, QEvent *event )
override;
195 QString aggregateFilter()
const;
209 bool needsGeometry()
const;
295 void changeAttribute(
const QString &
field,
const QVariant &value,
const QString &hintText = QString() );
302 void changeGeometry(
const QgsGeometry &geometry );
327 bool saveWithDetails( QString *error
SIP_OUT =
nullptr );
343 void refreshFeature();
354 void parentFormValueChanged(
const QString &attribute,
const QVariant &newValue );
357 void onAttributeChanged(
const QVariant &value,
const QVariantList &additionalFieldValues );
358 void onAttributeAdded(
int idx );
359 void onAttributeDeleted(
int idx );
360 void onRelatedFeaturesChanged();
361 void onUpdatedFields();
362 void onConstraintStatusChanged(
const QString &constraint,
364 void preventFeatureRefresh();
365 void synchronizeState();
366 void layerSelectionChanged();
369 bool saveMultiEdits();
370 void resetMultiEdit(
bool promptToSave =
false );
371 void multiEditMessageClicked(
const QString &link );
373 void filterAndTriggered();
374 void filterOrTriggered();
375 void filterTriggered();
379 void searchSetSelection();
380 void searchAddToSelection();
381 void searchRemoveFromSelection();
382 void searchIntersectSelection();
393 bool fieldIsEditable(
int fieldIndex )
const;
397 void updateFieldDependencies();
402 void setMultiEditFeatureIdsRelations(
const QgsFeatureIds &fids );
406 QWidget *widget =
nullptr;
410 bool labelOnTop =
false;
411 bool labelAlignRight =
false;
412 bool showLabel =
true;
422 void createWrappers();
423 void afterWidgetInit();
425 void scanForEqualAttributes(
QgsFeatureIterator &fit, QSet< int > &mixedValueFields, QHash< int, QVariant > &fieldSharedValues )
const;
428 bool saveEdits( QString *error );
433 void updateValuesDependencies(
const int originIdx );
434 void updateValuesDependenciesDefaultValues(
const int originIdx );
435 void updateValuesDependenciesVirtualFields(
const int originIdx );
436 void updateRelatedLayerFields();
438 void clearMultiEditMessages();
439 void pushSelectedFeaturesMessage();
442 QString createFilterExpression()
const;
447 void updateAllConstraints();
449 void updateContainersVisibility();
452 void updateEditableState();
453 bool currentFormValuesFeature(
QgsFeature &feature );
454 bool currentFormValidConstraints( QStringList &invalidFields, QStringList &descriptions )
const;
455 bool currentFormValidHardConstraints( QStringList &invalidFields, QStringList &descriptions )
const;
465 bool mOwnsMessageBar;
468 QList<QgsWidgetWrapper *> mWidgets;
470 std::unique_ptr<QgsExpressionContextScope> mExtraContextScope;
471 QDialogButtonBox *mButtonBox =
nullptr;
472 QWidget *mSearchButtonBox =
nullptr;
473 QList<QgsAttributeFormInterface *> mInterfaces;
474 QMultiMap< int, QgsAttributeFormEditorWidget * > mFormEditorWidgets;
475 QList< QgsAttributeFormWidget *> mFormWidgets;
476 QMap<const QgsVectorLayerJoinInfo *, QgsFeature> mJoinedFeatures;
477 QMap<QLabel *, QgsProperty> mLabelDataDefinedProperties;
478 QMap<QWidget *, QgsProperty> mEditableDataDefinedProperties;
479 bool mValuesInitialized =
false;
481 bool mIsSettingFeature =
false;
483 bool mValidConstraints =
true;
486 struct ContainerInformation
489 : tabWidget( tabWidget )
491 , expression( expression )
495 ContainerInformation( QWidget *widget,
const QgsExpression &expression )
497 , expression( expression )
501 ContainerInformation( QWidget *widget,
const QgsExpression &visibilityExpression,
bool collapsed,
const QgsExpression &collapsedExpression )
503 , expression( visibilityExpression )
505 , isCollapsed( collapsed )
506 , collapsedExpression( collapsedExpression )
511 QWidget *widget =
nullptr;
514 bool isCollapsed =
false;
520 void registerContainerInformation( ContainerInformation *info );
524 void reloadIcon(
const QString &file,
const QString &tooltip, QSvgWidget *sw );
527 QVector<ContainerInformation *> mContainerVisibilityCollapsedInformation;
528 QMap<QString, QVector<ContainerInformation *> > mContainerInformationDependency;
531 static int sFormCounter;
533 QString mPyFormVarName;
539 bool mPreventFeatureRefresh;
541 bool mIsSettingMultiEditFeatures;
544 bool mUnsavedMultiEditChanges;
546 QString mEditCommandMessage;
550 QMap<QWidget *, QSvgWidget *> mIconMap;
556 QMultiMap<int, QgsWidgetWrapper *> mDefaultValueDependencies;
562 QMultiMap<int, QgsWidgetWrapper *> mVirtualFieldsDependencies;
567 QSet<QgsEditorWidgetWrapper *> mRelatedLayerFieldsDependencies;
570 QList<int> mAlreadyUpdatedFields;
572 bool mNeedsGeometry =
false;
574 friend class TestQgsDualView;
575 friend class TestQgsAttributeForm;
SelectBehavior
Specifies how a selection should be applied.
This class contains context information for attribute editor widgets.
This is an abstract base class for any elements of a drag and drop form.
Single scope for storing variables and functions for use within a QgsExpressionContext.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Class for parsing and evaluation of expressions (formerly called "search strings").
Wrapper for iterator of features from vector data provider or vector layer.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
A geometry is the spatial representation of a feature.
Represents an item shown within a QgsMessageBar widget.
A bar for displaying non-blocking messages to the user.
Represents a vector layer which manages a vector based data sets.
QSet< QgsFeatureId > QgsFeatureIds
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
The TabStyle struct defines color and font overrides for form fields, tabs and groups labels.