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;
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
Gets field at particular index (must be in range 0..N-1)
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.
A bar for displaying non-blocking messages to the user.
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).
Represents a vector layer which manages a vector based data sets.
QgsFields fields() const FINAL
Returns the list of fields of this layer.