70 qDeleteAll( mWidgetFactories );
76 int index = fields.
indexOf( fieldName );
84 return mAutoConf.editorWidgetSetup( vl, fieldName );
91 return create( setup.
type(), vl, fieldIdx, setup.
config(), editor, parent, context );
96 if ( mWidgetFactories.contains( widgetId ) )
112 QString wid = findSuitableWrapper( editor, QStringLiteral(
"TextEdit" ) );
113 ww = mWidgetFactories[wid]->create( vl, fieldIdx, editor, parent );
127 if ( mWidgetFactories.contains( widgetId ) )
147 if ( mWidgetFactories.contains( widgetId ) )
149 return mWidgetFactories[widgetId]->configWidget( vl, fieldIdx, parent );
156 if ( mWidgetFactories.contains( widgetId ) )
158 return mWidgetFactories[widgetId]->name();
166 return mWidgetFactories;
171 return mWidgetFactories.value( widgetId, mFallbackWidgetFactory.get() );
176 if ( !widgetFactory )
181 else if ( mWidgetFactories.contains( widgetId ) )
188 mWidgetFactories.insert( widgetId, widgetFactory );
192 QHash<const char *, int>::ConstIterator it;
193 it = types.constBegin();
195 for ( ; it != types.constEnd(); ++it )
197 if ( it.value() > mFactoriesByType[it.key()].first )
199 mFactoriesByType[it.key()] = qMakePair( it.value(), widgetId );
207 QString QgsEditorWidgetRegistry::findSuitableWrapper( QWidget *editor,
const QString &defaultWidget )
209 QMap<const char *, QPair<int, QString> >::ConstIterator it;
218 it = mFactoriesByType.constBegin();
219 for ( ; it != mFactoriesByType.constEnd(); ++it )
221 if ( editor->staticMetaObject.className() == it.key() )
224 return it.value().second;
226 else if ( editor->inherits( it.key() ) )
229 if ( it.value().first > weight )
231 weight = it.value().first;
232 widgetid = it.value().second;
238 if ( widgetid.isNull() )
239 widgetid = defaultWidget;
This class contains context information for attribute editor widgets.
A bar for displaying non-blocking messages to the user.
Container of fields for a vector layer.
QgsField at(int i) const
Gets field at particular index (must be in range 0..N-1)
Map canvas is a class for displaying all GIS data types on a canvas.
static QgsMessageLog * messageLog()
Returns the application's message log.
QgsFields fields() const FINAL
Returns the list of fields of this layer.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
int indexOf(const QString &fieldName) const
Gets the field index from the field name.
QgsField field(int fieldIdx) const
Gets field at particular index (must be in range 0..N-1)
Represents a vector layer which manages a vector based data sets.
QgsEditorWidgetSetup editorWidgetSetup() const
Gets the editor widget setup for the field.