27 #include <QStackedWidget> 32 , mWidget( editorWidget )
34 , mMode( DefaultMode )
36 , mBlockValueUpdate( false )
59 connect( mSearchWidgetToolButton, SIGNAL( activeFlagsChanged( QgsSearchWidgetWrapper::FilterFlags ) ),
60 this, SLOT( searchWidgetFlagsChanged( QgsSearchWidgetWrapper::FilterFlags ) ) );
61 l->
addWidget( mSearchWidgetToolButton, 0 );
74 if ( !mWidget || !mForm )
84 connect( mMultiEditButton, SIGNAL( resetFieldValueTriggered() ),
this, SLOT( resetValue() ) );
85 connect( mMultiEditButton, SIGNAL( setFieldValueTriggered() ),
this, SLOT( setFieldTriggered() ) );
95 delete mMultiEditButton;
101 mSearchFrame, context );
108 mSearchFrame, context );
109 mSearchWidgets << sww2;
111 sww2->widget()->hide();
117 mSearchWidgets.
clear();
118 mSearchWidgets << wrapper;
121 mSearchWidgetToolButton->
setActiveFlags( QgsSearchWidgetWrapper::FilterFlags() );
123 connect( wrapper, SIGNAL(
valueChanged() ), mSearchWidgetToolButton, SLOT( searchWidgetValueChanged() ) );
124 connect( wrapper, SIGNAL( valueCleared() ), mSearchWidgetToolButton, SLOT( setInactive() ) );
134 return mSearchWidgets;
145 if ( mWidget && mixed )
154 mPreviousValue = mWidget->
value();
174 mBlockValueUpdate =
true;
176 mBlockValueUpdate =
false;
178 mPreviousValue = initialValue;
186 return mWidget->
value();
191 if ( mSearchWidgets.
isEmpty() )
194 if ( !mSearchWidgetToolButton->
isActive() )
202 return QString(
"%1 AND %2" ).
arg( filter1, filter2 );
209 return QString(
"%1 OR %2" ).
arg( filter1, filter2 );
212 return mSearchWidgets.
at( 0 )->createExpression( mSearchWidgetToolButton->
activeFlags() );
215 void QgsAttributeFormEditorWidget::editorWidgetChanged(
const QVariant& value )
217 if ( mBlockValueUpdate )
234 void QgsAttributeFormEditorWidget::resetValue()
237 mBlockValueUpdate =
true;
239 mWidget->
setValue( mPreviousValue );
240 mBlockValueUpdate =
false;
250 if ( mWidget && mIsMixed )
257 void QgsAttributeFormEditorWidget::setFieldTriggered()
262 void QgsAttributeFormEditorWidget::searchWidgetFlagsChanged( QgsSearchWidgetWrapper::FilterFlags flags )
268 if ( !mSearchWidgetToolButton->
isActive() )
274 if ( mSearchWidgets.
count() >= 2 )
283 return mSearchWidgetToolButton;
288 return mForm ? mForm->
layer() :
nullptr;
291 void QgsAttributeFormEditorWidget::updateWidgets()
294 bool hasMultiEditButton = ( mEditPage->
layout()->
indexOf( mMultiEditButton ) >= 0 );
297 if ( hasMultiEditButton )
void setContentsMargins(int left, int top, int right, int bottom)
This class contains context information for attribute editor widgets.
const T & at(int i) const
QgsEditFormConfig * editFormConfig() const
Get the configuration of the form used to represent this vector layer.
virtual int indexOf(QWidget *widget) const
int count(const T &value) const
QVariantMap QgsEditorWidgetConfig
Holds a set of configuration parameters for a editor widget wrapper.
void setObjectName(const QString &name)
void setMargin(int margin)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Represents a vector layer which manages a vector based data sets.
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const