Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1877

Exposing QAbstractItemModel as Qt property to QML is confusing

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • 6.8.0, 6.7.3
    • 6.2.4
    • PySide
    • None
    • All
    • 8c92fc7442da76d856f29c394d727f34170cde6d, 9b17919d6f8bb3d6207b6baea9e8c9ac9229de1f

    Description

      Trying to expose a QAbstractItemModel derived class as a property from Python to QML is somewhat confusing.

      When choosing the model's class type or QAbstractItemModel as the property type, the QML engine throws an error along the lines of QMetaProperty::read: Unable to handle unregistered datatype 'QAbstractListModel*' for property 'LockHandler::qmlModel'.

      One would expect this to work, since QAbstractItemModel is a QObject derived class.

      Instead, exposing the model a QObject or QVariant type property leads to the correct results.

      I attached an example program which shows different ways of exposing the model to QML and what is seen from QML.

      Attachments

        Issue Links

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

          Activity

            People

              kleint Friedemann Kleint
              strahlex Alexander Rössler
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes