Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Expose QAbstractItemModel as a property?

Expose QAbstractItemModel as a property?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 3 Posters 468 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    maxwell31
    wrote on last edited by
    #1

    Is it possible to expose a QAbstractItemModel which is a member of a Q_OBJECT as a Q_PROPERTY to qml? If so, what is the right object type?

    sierdzioS 1 Reply Last reply
    0
    • M maxwell31

      Is it possible to expose a QAbstractItemModel which is a member of a Q_OBJECT as a Q_PROPERTY to qml? If so, what is the right object type?

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @maxwell31 said in Expose QAbstractItemModel as a property?:

      Is it possible to expose a QAbstractItemModel which is a member of a Q_OBJECT as a Q_PROPERTY to qml?

      Yes.

      If so, what is the right object type?

      QObject *

      (Z(:^

      1 Reply Last reply
      0
      • GrecKoG Offline
        GrecKoG Offline
        GrecKo
        Qt Champions 2018
        wrote on last edited by
        #3

        The right type to expose it is QAbstractItemModel* or a pointer to your own subclass type if you exposed more functionality.

        You might have to call qmlRegisterType<T>() (the one with no parameters is enough here).

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved