void QgsAttributeFormEditorWidget::createSearchWidgetWrappers( const QString &widgetId, int fieldIdx, const QVariantMap &config, const QgsAttributeEditorContext &context ) { QgsSearchWidgetWrapper *sww = QgsGui::editorWidgetRegistry()->createSearchWidget( widgetId, layer(), fieldIdx, config, mSearchFrame, context ); setSearchWidgetWrapper( sww ); if ( sww->supportedFlags() & QgsSearchWidgetWrapper::Between || sww->supportedFlags() & QgsSearchWidgetWrapper::IsNotBetween ) { // create secondary widget for between type searches QgsSearchWidgetWrapper *sww2 = QgsGui::editorWidgetRegistry()->createSearchWidget( widgetId, layer(), fieldIdx, config, mSearchFrame, context ); mSearchWidgets << sww2; mSearchFrame->layout()->addWidget( sww2->widget() ); sww2->widget()->hide(); } }
QgsSearchWidgetWrapper* QgsEditorWidgetRegistry::createSearchWidget( const QString& widgetId, QgsVectorLayer* vl, int fieldIdx, const QgsEditorWidgetConfig& config, QWidget* parent, const QgsAttributeEditorContext &context ) { if ( mWidgetFactories.contains( widgetId ) ) { QgsSearchWidgetWrapper* ww = mWidgetFactories[widgetId]->createSearchWidget( vl, fieldIdx, parent ); if ( ww ) { ww->setConfig( config ); ww->setContext( context ); // Make sure that there is a widget created at this point // so setValue() et al won't crash ww->widget(); return ww; } } return 0; }
void QgsAttributeFormEditorWidget::createSearchWidgetWrappers( const QgsAttributeEditorContext &context ) { Q_ASSERT( !mWidgetType.isEmpty() ); const QVariantMap config = mWidget->config(); const int fieldIdx = mWidget->fieldIdx(); QgsSearchWidgetWrapper *sww = QgsGui::editorWidgetRegistry()->createSearchWidget( mWidgetType, layer(), fieldIdx, config, searchWidgetFrame(), context ); setSearchWidgetWrapper( sww ); searchWidgetFrame()->layout()->addWidget( mAggregateButton ); if ( sww->supportedFlags() & QgsSearchWidgetWrapper::Between || sww->supportedFlags() & QgsSearchWidgetWrapper::IsNotBetween ) { // create secondary widget for between type searches QgsSearchWidgetWrapper *sww2 = QgsGui::editorWidgetRegistry()->createSearchWidget( mWidgetType, layer(), fieldIdx, config, searchWidgetFrame(), context ); addAdditionalSearchWidgetWrapper( sww2 ); } }