16#ifndef QGSATTRIBUTEFORM_H
17#define QGSATTRIBUTEFORM_H
26#include <QDialogButtonBox>
94 void displayWarning(
const QString &message );
102 void hideButtonBox();
110 void showButtonBox();
118 void disconnectButtonBox();
170 bool eventFilter( QObject *
object, QEvent *event )
override;
194 QString aggregateFilter()
const;
208 bool needsGeometry()
const;
294 void changeAttribute(
const QString &
field,
const QVariant &value,
const QString &hintText = QString() );
301 void changeGeometry(
const QgsGeometry &geometry );
326 bool saveWithDetails( QString *error
SIP_OUT =
nullptr );
342 void refreshFeature();
353 void parentFormValueChanged(
const QString &attribute,
const QVariant &newValue );
356 void onAttributeChanged(
const QVariant &value,
const QVariantList &additionalFieldValues );
357 void onAttributeAdded(
int idx );
358 void onAttributeDeleted(
int idx );
359 void onRelatedFeaturesChanged();
360 void onUpdatedFields();
361 void onConstraintStatusChanged(
const QString &constraint,
363 void preventFeatureRefresh();
364 void synchronizeState();
365 void layerSelectionChanged();
368 bool saveMultiEdits();
369 void resetMultiEdit(
bool promptToSave =
false );
370 void multiEditMessageClicked(
const QString &link );
372 void filterAndTriggered();
373 void filterOrTriggered();
374 void filterTriggered();
378 void searchSetSelection();
379 void searchAddToSelection();
380 void searchRemoveFromSelection();
381 void searchIntersectSelection();
392 bool fieldIsEditable(
int fieldIndex )
const;
396 void updateFieldDependencies();
401 void setMultiEditFeatureIdsRelations(
const QgsFeatureIds &fids );
405 QWidget *widget =
nullptr;
409 bool labelOnTop =
false;
410 bool labelAlignRight =
false;
411 bool showLabel =
true;
421 void createWrappers();
422 void afterWidgetInit();
424 void scanForEqualAttributes(
QgsFeatureIterator &fit, QSet< int > &mixedValueFields, QHash< int, QVariant > &fieldSharedValues )
const;
427 bool saveEdits( QString *error );
432 void updateValuesDependencies(
const int originIdx );
433 void updateValuesDependenciesDefaultValues(
const int originIdx );
434 void updateValuesDependenciesVirtualFields(
const int originIdx );
435 void updateRelatedLayerFields();
437 void clearMultiEditMessages();
438 void pushSelectedFeaturesMessage();
441 QString createFilterExpression()
const;
446 void updateAllConstraints();
448 void updateContainersVisibility();
451 void updateEditableState();
452 bool currentFormValuesFeature(
QgsFeature &feature );
453 bool currentFormValidConstraints( QStringList &invalidFields, QStringList &descriptions )
const;
454 bool currentFormValidHardConstraints( QStringList &invalidFields, QStringList &descriptions )
const;
464 bool mOwnsMessageBar;
467 QList<QgsWidgetWrapper *> mWidgets;
469 std::unique_ptr<QgsExpressionContextScope> mExtraContextScope;
470 QDialogButtonBox *mButtonBox =
nullptr;
471 QWidget *mSearchButtonBox =
nullptr;
472 QList<QgsAttributeFormInterface *> mInterfaces;
473 QMultiMap< int, QgsAttributeFormEditorWidget * > mFormEditorWidgets;
474 QList< QgsAttributeFormWidget *> mFormWidgets;
475 QMap<const QgsVectorLayerJoinInfo *, QgsFeature> mJoinedFeatures;
476 QMap<QLabel *, QgsProperty> mLabelDataDefinedProperties;
477 QMap<QWidget *, QgsProperty> mEditableDataDefinedProperties;
478 bool mValuesInitialized =
false;
480 bool mIsSettingFeature =
false;
482 bool mValidConstraints =
true;
485 struct ContainerInformation
488 : tabWidget( tabWidget )
490 , expression( expression )
494 ContainerInformation( QWidget *widget,
const QgsExpression &expression )
496 , expression( expression )
500 ContainerInformation( QWidget *widget,
const QgsExpression &visibilityExpression,
bool collapsed,
const QgsExpression &collapsedExpression )
502 , expression( visibilityExpression )
504 , isCollapsed( collapsed )
505 , collapsedExpression( collapsedExpression )
510 QWidget *widget =
nullptr;
513 bool isCollapsed =
false;
519 void registerContainerInformation( ContainerInformation *info );
523 void reloadIcon(
const QString &file,
const QString &tooltip, QSvgWidget *sw );
526 QVector<ContainerInformation *> mContainerVisibilityCollapsedInformation;
527 QMap<QString, QVector<ContainerInformation *> > mContainerInformationDependency;
530 static int sFormCounter;
532 QString mPyFormVarName;
538 bool mPreventFeatureRefresh;
540 bool mIsSettingMultiEditFeatures;
543 bool mUnsavedMultiEditChanges;
545 QString mEditCommandMessage;
549 QMap<QWidget *, QSvgWidget *> mIconMap;
555 QMultiMap<int, QgsWidgetWrapper *> mDefaultValueDependencies;
561 QMultiMap<int, QgsWidgetWrapper *> mVirtualFieldsDependencies;
566 QSet<QgsEditorWidgetWrapper *> mRelatedLayerFieldsDependencies;
569 QList<int> mAlreadyUpdatedFields;
571 bool mNeedsGeometry =
false;
573 friend class TestQgsDualView;
574 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.