Using C++ QAbstractTableView in Qml
-
wrote on 11 Jun 2019, 07:15 last edited by
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!
-
wrote on 11 Jun 2019, 12:01 last edited by
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...)
-
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...)
wrote on 11 Jun 2019, 12:05 last edited by@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!
-
wrote on 11 Jun 2019, 12:17 last edited by
But it is true that Qt should provide a QML Item which already provides support for headers, selection, sorting...
1/4