-
Type:
Suggestion
-
Status: Closed
-
Priority:
P3: Somewhat important
-
Resolution: Done
-
Affects Version/s: 4.3.1
-
Fix Version/s: Some future release
-
Component/s: Widgets: Itemviews
-
Labels:None
In the current QItemEditorFactory API, registering an editor for a custom user type that has been declared as a QMetaType (using Q_DECLARE_METATYPE) is somewhat cumbersome. The problem is that QItemEditorFactory::registerEditor() takes a QVariant::Type argument, but the exact type cannot be determined using the QVariant API. Calling 'nameToType' is not sufficient because this just returns QVariant::UserType.
A workaround is to call 'qMetaTypeId' with the data type (or QVariant::userType() with an instance) and then cast this to a 'QVariant::Type', but a better solution would be to have a registerEditor() function that took an 'int'.