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. Using C++ QAbstractTableView in Qml
QtWS25 Last Chance

Using C++ QAbstractTableView in Qml

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 2 Posters 355 Views
  • 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.
  • P Offline
    P Offline
    patrickkidd
    wrote on last edited by
    #1

    I have a QtWidgets app that uses a QTableView with a custom C++ QAbstractTableModel. I need to implement this on iPad so I am going with QtQuick. It looks like both the TableViews in QtQuick.Controls is not a drop-in replacement for QTableView. In fact, the semantics of "roles" appears to be totally different, where it asks for a particular role instead of a particular column.

    What's the rationale behind that strange semantic change? And what is the best way to replicate the functionality of a QTableView with a C++ QAbstractTableModel?

    Thanks!

    https://alaskafamilysystems.com/

    1 Reply Last reply
    0
    • M Offline
      M Offline
      maxwell31
      wrote on last edited by
      #2

      I think the QtQuick Tableview would be a drop-in replacement, although you need to do the styling and headers on your own.

      And yes the QuickControls1 TableView will not take columns into account, but uses roles instead.

      My suggestion, use the QtQuick TableView and do your custom delegates and headers (and selection, sorting...)

      P 1 Reply Last reply
      0
      • M maxwell31

        I think the QtQuick Tableview would be a drop-in replacement, although you need to do the styling and headers on your own.

        And yes the QuickControls1 TableView will not take columns into account, but uses roles instead.

        My suggestion, use the QtQuick TableView and do your custom delegates and headers (and selection, sorting...)

        P Offline
        P Offline
        patrickkidd
        wrote on last edited by
        #3

        @maxwell31 said in Using C++ QAbstractTableView in Qml:

        I think the QtQuick Tableview would be a drop-in replacement, although you need to do the styling and headers on your own.

        And yes the QuickControls1 TableView will not take columns into account, but uses roles instead.

        My suggestion, use the QtQuick TableView and do your custom delegates and headers (and selection, sorting...)

        Yep, it looks like QtQtuick.Controls.TableView is the way to go there. Thanks!

        https://alaskafamilysystems.com/

        1 Reply Last reply
        0
        • M Offline
          M Offline
          maxwell31
          wrote on last edited by
          #4

          But it is true that Qt should provide a QML Item which already provides support for headers, selection, sorting...

          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