16#include "moc_qgsattributeformwidget.cpp"
18#include <QStackedWidget>
28 mEditPage =
new QWidget();
29 QHBoxLayout *l =
new QHBoxLayout();
30 l->setContentsMargins( 0, 0, 0, 0 );
31 mEditPage->setLayout( l );
33 l =
new QHBoxLayout();
34 l->setContentsMargins( 0, 0, 0, 0 );
35 mSearchFrame =
new QWidget();
36 mSearchFrame->setLayout( l );
38 mSearchPage =
new QWidget();
39 l =
new QHBoxLayout();
40 l->setContentsMargins( 0, 0, 0, 0 );
41 mSearchPage->setLayout( l );
42 l->addWidget( mSearchFrame, 1 );
44 mSearchWidgetToolButton->setObjectName( QStringLiteral(
"SearchWidgetToolButton" ) );
46 l->addWidget( mSearchWidgetToolButton, 0 );
48 mStack =
new QStackedWidget();
60 l =
new QHBoxLayout();
61 l->setContentsMargins( 0, 0, 0, 0 );
63 l->addWidget( mStack );
65 if ( !mWidget || !mForm )
68 mEditPage->layout()->addWidget( mWidget->
widget() );
71 setSizePolicy( mWidget->
widget()->sizePolicy() );
83 mSearchPage =
nullptr;
104 mSearchWidgets.clear();
105 mSearchWidgets << wrapper;
106 mSearchFrame->layout()->addWidget( wrapper->widget() );
107 mSearchWidgetToolButton->setAvailableFlags( wrapper->supportedFlags() );
109 mSearchWidgetToolButton->setDefaultFlags( wrapper->defaultFlags() );
116 mSearchWidgets << wrapper;
118 mSearchFrame->layout()->addWidget( wrapper->
widget() );
119 wrapper->
widget()->hide();
124 return mSearchWidgets;
129 if ( mSearchWidgets.isEmpty() )
132 if ( !mSearchWidgetToolButton->
isActive() )
140 return QStringLiteral(
"%1 AND %2" ).arg( filter1, filter2 );
147 return QStringLiteral(
"%1 OR %2" ).arg( filter1, filter2 );
150 return mSearchWidgets.at( 0 )->createExpression( mSearchWidgetToolButton->
activeFlags() );
156 const auto constMSearchWidgets = mSearchWidgets;
159 widget->clearWidget();
165 return mWidget->
layer();
170 const auto constMSearchWidgets = mSearchWidgets;
174 if ( !mSearchWidgetToolButton->
isActive() )
176 widget->clearWidget();
180 if ( mSearchWidgets.count() >= 2 )
186void QgsAttributeFormWidget::updateWidgets()
193 QWidget *currentVisibleWidget = mStack->currentWidget();
195 QWidget *newVisibleWidget =
nullptr;
200 newVisibleWidget = mEditPage;
206 newVisibleWidget = mSearchPage;
211 if ( newVisibleWidget != currentVisibleWidget )
213 if ( currentVisibleWidget )
216 mStack->removeWidget( currentVisibleWidget );
219 mStack->addWidget( newVisibleWidget );
220 mStack->setCurrentWidget( newVisibleWidget );
226 return mSearchWidgetToolButton->isVisible();
Represents a vector layer which manages a vector based data sets.