16 #include <QHBoxLayout> 17 #include <QStackedWidget> 24 , mMode( DefaultMode )
28 mEditPage =
new QWidget();
29 QHBoxLayout *l =
new QHBoxLayout();
31 l->setContentsMargins( 0, 0, 0, 0 );
32 mEditPage->setLayout( l );
34 l =
new QHBoxLayout();
36 l->setContentsMargins( 0, 0, 0, 0 );
37 mSearchFrame =
new QWidget();
38 mSearchFrame->setLayout( l );
40 mSearchPage =
new QWidget();
41 l =
new QHBoxLayout();
43 l->setContentsMargins( 0, 0, 0, 0 );
44 mSearchPage->setLayout( l );
45 l->addWidget( mSearchFrame, 1 );
47 mSearchWidgetToolButton->setObjectName( QStringLiteral(
"SearchWidgetToolButton" ) );
49 this, &QgsAttributeFormWidget::searchWidgetFlagsChanged );
50 l->addWidget( mSearchWidgetToolButton, 0 );
53 mStack =
new QStackedWidget;
54 mStack->addWidget( mEditPage );
55 mStack->addWidget( mSearchPage );
57 l =
new QHBoxLayout();
59 l->setContentsMargins( 0, 0, 0, 0 );
61 l->addWidget( mStack );
63 if ( !mWidget || !mForm )
66 mEditPage->layout()->addWidget( mWidget->
widget() );
89 mSearchWidgets.clear();
90 mSearchWidgets << wrapper;
91 mSearchFrame->layout()->addWidget( wrapper->widget() );
93 mSearchWidgetToolButton->
setActiveFlags( QgsSearchWidgetWrapper::FilterFlags() );
101 mSearchWidgets << wrapper;
103 mSearchFrame->layout()->addWidget( wrapper->widget() );
104 wrapper->widget()->hide();
109 return mSearchWidgets;
114 if ( mSearchWidgets.isEmpty() )
117 if ( !mSearchWidgetToolButton->
isActive() )
125 return QStringLiteral(
"%1 AND %2" ).arg( filter1, filter2 );
132 return QStringLiteral(
"%1 OR %2" ).arg( filter1, filter2 );
135 return mSearchWidgets.at( 0 )->createExpression( mSearchWidgetToolButton->
activeFlags() );
149 return mWidget->
layer();
152 void QgsAttributeFormWidget::searchWidgetFlagsChanged( QgsSearchWidgetWrapper::FilterFlags flags )
158 if ( !mSearchWidgetToolButton->
isActive() )
164 if ( mSearchWidgets.count() >= 2 )
171 void QgsAttributeFormWidget::updateWidgets()
177 mStack->setCurrentWidget( mEditPage );
183 mStack->setCurrentWidget( mSearchPage );
192 return mSearchWidgetToolButton->isVisible();
197 mSearchWidgetToolButton->setVisible( searchWidgetToolButtonVisible );
Represents a vector layer which manages a vector based data sets.