Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-30392

QItemEditorFactory should use QMetaType::Type instead of QVariant::Type

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • Not Evaluated
    • 5.0.0
    • 4.8.1
    • Widgets: Itemviews
    • 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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            stephen.kelly Stephen Kelly (Unused account) (Inactive)
            dfranke Daniel Franke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes