Details
-
Suggestion
-
Resolution: Done
-
Not Evaluated
-
4.8.1
-
None
Description
QItemEditorFactory can be used to register a custom editor for any QVariant types. However, QVariant can be extended by Q_DECLARE_METATYPE(MyType).
To register a custom editor for s custom type, one has to:
QItemEditorFactory *factory = new QItemEditorFactory();
factory->registerEditor((QVariant::Type)qMetaTypeId<MyType>(),
new QStandardItemEditorCreator<MyTypeEditor>());
and
factory->createEditor((QVariant::Type)qMetaTypeId<MyType>(), parent);
"Type QVariant::type" states:
Returns the storage type of the value stored in the variant. Although this function is declared as returning QVariant::Type, the return value should be interpreted as QMetaType::Type.
Thus I'd like to propose that QItemEditorFactory::registerEditor and QItemEditorFactory::createEditor should accept QMetaType::Type instead QVariant::Type for improved usability.