29 #include <QStackedWidget> 33 , mWidgetType( widgetType )
34 , mWidget( editorWidget )
37 , mBlockValueUpdate( false )
41 mConstraintResultLabel =
new QLabel(
this );
42 mConstraintResultLabel->setObjectName( QStringLiteral(
"ConstraintStatus" ) );
43 mConstraintResultLabel->setSizePolicy( QSizePolicy::Fixed, mConstraintResultLabel->sizePolicy().verticalPolicy() );
68 delete mMultiEditButton;
73 Q_ASSERT( !mWidgetType.isEmpty() );
74 const QVariantMap config = mWidget->
config();
75 const int fieldIdx = mWidget->
fieldIdx();
96 mConstraintResultLabel->setText( QStringLiteral(
"<font color=\"#FF9800\">%1</font>" ).arg( QChar( 0x2718 ) ) );
97 mConstraintResultLabel->setToolTip( description.isEmpty() ? QStringLiteral(
"<b>%1</b>: %2" ).arg( constraint, err ) : description );
101 mConstraintResultLabel->setText( QStringLiteral(
"<font color=\"#FFC107\">%1</font>" ).arg( QChar( 0x2718 ) ) );
102 mConstraintResultLabel->setToolTip( description.isEmpty() ? QStringLiteral(
"<b>%1</b>: %2" ).arg( constraint, err ) : description );
106 mConstraintResultLabel->setText( QStringLiteral(
"<font color=\"#259B24\">%1</font>" ).arg( QChar( 0x2714 ) ) );
107 mConstraintResultLabel->setToolTip( description );
114 mConstraintResultLabel->setHidden( !editable );
119 if ( mWidget && mixed )
128 mPreviousValue = mWidget->
value();
141 mBlockValueUpdate =
true;
143 mBlockValueUpdate =
false;
145 mPreviousValue = initialValue;
153 return mWidget->
value();
158 void QgsAttributeFormEditorWidget::editorWidgetChanged(
const QVariant &value )
160 if ( mBlockValueUpdate )
178 void QgsAttributeFormEditorWidget::resetValue()
181 mBlockValueUpdate =
true;
183 mWidget->
setValue( mPreviousValue );
184 mBlockValueUpdate =
false;
195 if ( mWidget && mIsMixed )
202 void QgsAttributeFormEditorWidget::setFieldTriggered()
207 void QgsAttributeFormEditorWidget::onAggregateChanged()
210 searchWidget->setAggregate( mAggregateButton->
aggregate() );
213 void QgsAttributeFormEditorWidget::updateWidgets()
216 bool hasMultiEditButton = (
editPage()->layout()->indexOf( mMultiEditButton ) >= 0 );
219 if ( hasMultiEditButton )
223 editPage()->layout()->removeWidget( mMultiEditButton );
224 mMultiEditButton->setParent(
nullptr );
231 editPage()->layout()->addWidget( mMultiEditButton );
242 editPage()->layout()->addWidget( mConstraintResultLabel );
249 mAggregateButton->setVisible(
true );
256 mAggregateButton->setVisible(
false );
This class contains context information for attribute editor widgets.
static QgsEditorWidgetRegistry * editorWidgetRegistry()
Returns the global editor widget registry, used for managing all known edit widget factories...
QgsEditFormConfig editFormConfig