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();
169 bool eventFilter( QObject *
object, QEvent *event )
override;
190 QString aggregateFilter()
const;
204 bool needsGeometry()
const;
285 void changeAttribute(
const QString &field,
const QVariant &value,
const QString &hintText = QString() );
292 void changeGeometry(
const QgsGeometry &geometry );
317 bool saveWithDetails( QString *error
SIP_OUT =
nullptr );
332 void refreshFeature();
343 void parentFormValueChanged(
const QString &attribute,
const QVariant &newValue );
346 void onAttributeChanged(
const QVariant &value,
const QVariantList &additionalFieldValues );
347 void onAttributeAdded(
int idx );
348 void onAttributeDeleted(
int idx );
349 void onRelatedFeaturesChanged();
350 void onUpdatedFields();
351 void onConstraintStatusChanged(
const QString &constraint,
353 void preventFeatureRefresh();
354 void synchronizeState();
355 void layerSelectionChanged();
358 bool saveMultiEdits();
359 void resetMultiEdit(
bool promptToSave =
false );
360 void multiEditMessageClicked(
const QString &link );
362 void filterAndTriggered();
363 void filterOrTriggered();
364 void filterTriggered();
368 void searchSetSelection();
369 void searchAddToSelection();
370 void searchRemoveFromSelection();
371 void searchIntersectSelection();
382 bool fieldIsEditable(
int fieldIndex )
const;
386 void updateFieldDependencies();
391 void setMultiEditFeatureIdsRelations(
const QgsFeatureIds &fids );
395 QWidget *widget =
nullptr;
399 bool labelOnTop =
false;
400 bool labelAlignRight =
false;
401 bool showLabel =
true;
411 void createWrappers();
412 void afterWidgetInit();
414 void scanForEqualAttributes(
QgsFeatureIterator &fit, QSet< int > &mixedValueFields, QHash< int, QVariant > &fieldSharedValues )
const;
417 bool saveEdits( QString *error );
422 void updateValuesDependencies(
const int originIdx );
423 void updateValuesDependenciesDefaultValues(
const int originIdx );
424 void updateValuesDependenciesVirtualFields(
const int originIdx );
425 void updateRelatedLayerFields();
427 void clearMultiEditMessages();
428 void pushSelectedFeaturesMessage();
431 QString createFilterExpression()
const;
436 void updateAllConstraints();
438 void updateContainersVisibility();
441 void updateEditableState();
442 bool currentFormValuesFeature(
QgsFeature &feature );
443 bool currentFormValidConstraints( QStringList &invalidFields, QStringList &descriptions )
const;
444 bool currentFormValidHardConstraints( QStringList &invalidFields, QStringList &descriptions )
const;
454 bool mOwnsMessageBar;
457 QList<QgsWidgetWrapper *> mWidgets;
459 std::unique_ptr<QgsExpressionContextScope> mExtraContextScope;
460 QDialogButtonBox *mButtonBox =
nullptr;
461 QWidget *mSearchButtonBox =
nullptr;
462 QList<QgsAttributeFormInterface *> mInterfaces;
463 QMultiMap< int, QgsAttributeFormEditorWidget * > mFormEditorWidgets;
464 QList< QgsAttributeFormWidget *> mFormWidgets;
465 QMap<const QgsVectorLayerJoinInfo *, QgsFeature> mJoinedFeatures;
466 QMap<QLabel *, QgsProperty> mLabelDataDefinedProperties;
467 QMap<QWidget *, QgsProperty> mEditableDataDefinedProperties;
468 bool mValuesInitialized =
false;
470 bool mIsSettingFeature =
false;
472 bool mValidConstraints =
true;
475 struct ContainerInformation
478 : tabWidget( tabWidget )
480 , expression( expression )
484 ContainerInformation( QWidget *widget,
const QgsExpression &expression )
486 , expression( expression )
490 ContainerInformation( QWidget *widget,
const QgsExpression &visibilityExpression,
bool collapsed,
const QgsExpression &collapsedExpression )
492 , expression( visibilityExpression )
494 , isCollapsed( collapsed )
495 , collapsedExpression( collapsedExpression )
500 QWidget *widget =
nullptr;
503 bool isCollapsed =
false;
509 void registerContainerInformation( ContainerInformation *info );
513 void reloadIcon(
const QString &file,
const QString &tooltip, QSvgWidget *sw );
516 QVector<ContainerInformation *> mContainerVisibilityCollapsedInformation;
517 QMap<QString, QVector<ContainerInformation *> > mContainerInformationDependency;
520 static int sFormCounter;
522 QString mPyFormVarName;
528 bool mPreventFeatureRefresh;
530 bool mIsSettingMultiEditFeatures;
533 bool mUnsavedMultiEditChanges;
535 QString mEditCommandMessage;
539 QMap<QWidget *, QSvgWidget *> mIconMap;
545 QMultiMap<int, QgsWidgetWrapper *> mDefaultValueDependencies;
551 QMultiMap<int, QgsWidgetWrapper *> mVirtualFieldsDependencies;
556 QSet<QgsEditorWidgetWrapper *> mRelatedLayerFieldsDependencies;
559 QList<int> mAlreadyUpdatedFields;
561 bool mNeedsGeometry =
false;
563 friend class TestQgsDualView;
564 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.