73 qDeleteAll( mWidgetFactories );
79 int index = fields.
indexOf( fieldName );
87 return mAutoConf.editorWidgetSetup( vl, fieldName );
94 return create( setup.
type(), vl, fieldIdx, setup.
config(), editor, parent, context );
99 if ( mWidgetFactories.contains( widgetId ) )
115 QString wid = findSuitableWrapper( editor, QStringLiteral(
"TextEdit" ) );
116 ww = mWidgetFactories[wid]->create( vl, fieldIdx, editor, parent );
130 if ( mWidgetFactories.contains( widgetId ) )
150 if ( mWidgetFactories.contains( widgetId ) )
152 return mWidgetFactories[widgetId]->configWidget( vl, fieldIdx, parent );
159 if ( mWidgetFactories.contains( widgetId ) )
161 return mWidgetFactories[widgetId]->name();
169 return mWidgetFactories;
174 return mWidgetFactories.value( widgetId, mFallbackWidgetFactory.get() );
179 if ( !widgetFactory )
184 else if ( mWidgetFactories.contains( widgetId ) )
191 mWidgetFactories.insert( widgetId, widgetFactory );
195 QHash<const char *, int>::ConstIterator it;
196 it = types.constBegin();
198 for ( ; it != types.constEnd(); ++it )
200 if ( it.value() > mFactoriesByType[it.key()].first )
202 mFactoriesByType[it.key()] = qMakePair( it.value(), widgetId );
210 QString QgsEditorWidgetRegistry::findSuitableWrapper( QWidget *editor,
const QString &defaultWidget )
212 QMap<const char *, QPair<int, QString> >::ConstIterator it;
221 it = mFactoriesByType.constBegin();
222 for ( ; it != mFactoriesByType.constEnd(); ++it )
224 if ( editor->staticMetaObject.className() == it.key() )
227 return it.value().second;
229 else if ( editor->inherits( it.key() ) )
232 if ( it.value().first > weight )
234 weight = it.value().first;
235 widgetid = it.value().second;
241 if ( widgetid.isNull() )
242 widgetid = defaultWidget;