75 qDeleteAll( mWidgetFactories );
81 int index = fields.
indexOf( fieldName );
89 return mAutoConf.editorWidgetSetup( vl, fieldName );
96 return create( setup.
type(), vl, fieldIdx, setup.
config(), editor, parent, context );
101 if ( mWidgetFactories.contains( widgetId ) )
117 QString wid = findSuitableWrapper( editor, QStringLiteral(
"TextEdit" ) );
118 ww = mWidgetFactories[wid]->create( vl, fieldIdx, editor, parent );
132 if ( mWidgetFactories.contains( widgetId ) )
152 if ( mWidgetFactories.contains( widgetId ) )
154 return mWidgetFactories[widgetId]->configWidget( vl, fieldIdx, parent );
161 if ( mWidgetFactories.contains( widgetId ) )
163 return mWidgetFactories[widgetId]->name();
171 return mWidgetFactories;
176 return mWidgetFactories.value( widgetId, mFallbackWidgetFactory.get() );
181 if ( !widgetFactory )
186 else if ( mWidgetFactories.contains( widgetId ) )
193 mWidgetFactories.insert( widgetId, widgetFactory );
197 QHash<const char *, int>::ConstIterator it;
198 it = types.constBegin();
200 for ( ; it != types.constEnd(); ++it )
202 if ( it.value() > mFactoriesByType[it.key()].first )
204 mFactoriesByType[it.key()] = qMakePair( it.value(), widgetId );
212 QString QgsEditorWidgetRegistry::findSuitableWrapper( QWidget *editor,
const QString &defaultWidget )
214 QMap<const char *, QPair<int, QString> >::ConstIterator it;
223 it = mFactoriesByType.constBegin();
224 for ( ; it != mFactoriesByType.constEnd(); ++it )
226 if ( editor->staticMetaObject.className() == it.key() )
229 return it.value().second;
231 else if ( editor->inherits( it.key() ) )
234 if ( it.value().first > weight )
236 weight = it.value().first;
237 widgetid = it.value().second;
243 if ( widgetid.isNull() )
244 widgetid = defaultWidget;
static QgsMessageLog * messageLog()
Returns the application's message log.
This class contains context information for attribute editor widgets.
QgsEditorWidgetSetup editorWidgetSetup() const
Gets the editor widget setup for the field.
Container of fields for a vector layer.
int indexOf(const QString &fieldName) const
Gets the field index from the field name.
QgsField field(int fieldIdx) const
Returns the field at particular index (must be in range 0..N-1).
QgsField at(int i) const
Returns the 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.
A bar for displaying non-blocking messages to the user.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
Represents a vector layer which manages a vector based data sets.
QgsFields fields() const FINAL
Returns the list of fields of this layer.