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. [solved] correct implementation of ListView with C++
Forum Updated to NodeBB v4.3 + New Features

[solved] correct implementation of ListView with C++

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 3 Posters 1.3k 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.
  • D Offline
    D Offline
    dmcr
    wrote on last edited by
    #1

    Hello everybody

    I am enjoying QML for a while now, but i still haven't really solved the use of ListView built from C++ side objects.

    "This link ":http://doc-snapshot.qt-project.org/qt5-stable/qtquick/qtquick-modelviewsdata-cppmodels.html appears does not work with 5.1, and i am seeking for good manner in this field.

    dmcr

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stereomatching
      wrote on last edited by
      #2

      How about this link?
      "listView":http://cdumez.blogspot.com/2010/11/how-to-use-c-list-model-in-qml.html
      I haven't tried it on Qt5, hope this could solve your problem

      1 Reply Last reply
      0
      • C Offline
        C Offline
        chrisadams
        wrote on last edited by
        #3

        Hi,

        The docs you linked should work fine. Any model extending QAbstractListModel can be exposed as a type (via qmlRegisterType) to QML and used as a model for a ListView.

        When you say "appears not to work" what do you mean? Which errors do you see reported? What does your list view look like, what do your delegates look like, which roles does your model export as data?

        Cheers,
        Chris.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dmcr
          wrote on last edited by
          #4

          Hello, thank you for your answers.
          I finally get a rather good manner using QQmlListProperty which quite efficient and well explained.

          dmcr

          1 Reply Last reply
          0

          • Login

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