65 qDeleteAll( mWidgetFactories );
71 int index = fields.
indexOf( fieldName );
79 return mAutoConf.editorWidgetSetup( vl, fieldName );
86 return create( setup.
type(), vl, fieldIdx, setup.
config(), editor, parent, context );
91 if ( mWidgetFactories.contains( widgetId ) )
107 QString wid = findSuitableWrapper( editor, QStringLiteral(
"TextEdit" ) );
108 ww = mWidgetFactories[wid]->create( vl, fieldIdx, editor, parent );
122 if ( mWidgetFactories.contains( widgetId ) )
142 if ( mWidgetFactories.contains( widgetId ) )
144 return mWidgetFactories[widgetId]->configWidget( vl, fieldIdx, parent );
151 if ( mWidgetFactories.contains( widgetId ) )
153 return mWidgetFactories[widgetId]->name();
161 return mWidgetFactories;
166 return mWidgetFactories.value( widgetId );
171 if ( !widgetFactory )
176 else if ( mWidgetFactories.contains( widgetId ) )
183 mWidgetFactories.insert( widgetId, widgetFactory );
187 QHash<const char *, int>::ConstIterator it;
188 it = types.constBegin();
190 for ( ; it != types.constEnd(); ++it )
192 if ( it.value() > mFactoriesByType[it.key()].first )
194 mFactoriesByType[it.key()] = qMakePair( it.value(), widgetId );
202 QString QgsEditorWidgetRegistry::findSuitableWrapper( QWidget *editor,
const QString &defaultWidget )
204 QMap<const char *, QPair<int, QString> >::ConstIterator it;
213 it = mFactoriesByType.constBegin();
214 for ( ; it != mFactoriesByType.constEnd(); ++it )
216 if ( editor->staticMetaObject.className() == it.key() )
219 return it.value().second;
221 else if ( editor->inherits( it.key() ) )
224 if ( it.value().first > weight )
226 weight = it.value().first;
227 widgetid = it.value().second;
233 if ( widgetid.isNull() )
234 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.
QgsEditorWidgetSetup editorWidgetSetup() const
Get the editor widget setup for the field.
Map canvas is a class for displaying all GIS data types on a canvas.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::Warning)
add a message to the instance (and create it if necessary)
QgsField at(int i) const
Get field at particular index (must be in range 0..N-1)
static QgsMessageLog * messageLog()
Returns the application's message log.
QgsFields fields() const override
Returns the list of fields of this layer.
int indexOf(const QString &fieldName) const
Get the field index from the field name.
Represents a vector layer which manages a vector based data sets.
QgsField field(int fieldIdx) const
Get field at particular index (must be in range 0..N-1)