예제 #1
0
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();
  }
}
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 );
  }
}