16 #include <QHBoxLayout> 17 #include <QStackedWidget> 27 mEditPage =
new QWidget();
28 QHBoxLayout *l =
new QHBoxLayout();
30 l->setContentsMargins( 0, 0, 0, 0 );
31 mEditPage->setLayout( l );
33 l =
new QHBoxLayout();
35 l->setContentsMargins( 0, 0, 0, 0 );
36 mSearchFrame =
new QWidget();
37 mSearchFrame->setLayout( l );
39 mSearchPage =
new QWidget();
40 l =
new QHBoxLayout();
42 l->setContentsMargins( 0, 0, 0, 0 );
43 mSearchPage->setLayout( l );
44 l->addWidget( mSearchFrame, 1 );
46 mSearchWidgetToolButton->setObjectName( QStringLiteral(
"SearchWidgetToolButton" ) );
48 this, &QgsAttributeFormWidget::searchWidgetFlagsChanged );
49 l->addWidget( mSearchWidgetToolButton, 0 );
52 mStack =
new QStackedWidget;
53 mStack->addWidget( mEditPage );
54 mStack->addWidget( mSearchPage );
56 l =
new QHBoxLayout();
58 l->setContentsMargins( 0, 0, 0, 0 );
60 l->addWidget( mStack );
62 if ( !mWidget || !mForm )
65 mEditPage->layout()->addWidget( mWidget->
widget() );
88 mSearchWidgets.clear();
89 mSearchWidgets << wrapper;
90 mSearchFrame->layout()->addWidget( wrapper->widget() );
92 mSearchWidgetToolButton->
setActiveFlags( QgsSearchWidgetWrapper::FilterFlags() );
100 mSearchWidgets << wrapper;
102 mSearchFrame->layout()->addWidget( wrapper->widget() );
103 wrapper->widget()->hide();
108 return mSearchWidgets;
113 if ( mSearchWidgets.isEmpty() )
116 if ( !mSearchWidgetToolButton->
isActive() )
124 return QStringLiteral(
"%1 AND %2" ).arg( filter1, filter2 );
131 return QStringLiteral(
"%1 OR %2" ).arg( filter1, filter2 );
134 return mSearchWidgets.at( 0 )->createExpression( mSearchWidgetToolButton->
activeFlags() );
148 return mWidget->
layer();
151 void QgsAttributeFormWidget::searchWidgetFlagsChanged( QgsSearchWidgetWrapper::FilterFlags flags )
157 if ( !mSearchWidgetToolButton->
isActive() )
163 if ( mSearchWidgets.count() >= 2 )
170 void QgsAttributeFormWidget::updateWidgets()
176 mStack->setCurrentWidget( mEditPage );
182 mStack->setCurrentWidget( mSearchPage );
191 return mSearchWidgetToolButton->isVisible();
196 mSearchWidgetToolButton->setVisible( searchWidgetToolButtonVisible );
Represents a vector layer which manages a vector based data sets.