Unsolved QML Treeview
-
Hello,
I need to use a Treeview in my application and I noticed that there is only one available for Quick Controls 1, but none for Quick Controls 2.
What is the best way to get a Tree View in Quick Controls 2? -
There isn't one. According to this:
https://doc.qt.io/qt-5/qtquickcontrols2-differences.html
You'll see there is no TreeView in 2, and no alternate to use. Why they dropped it, you'd have to ask a Qt developer.
As for best way to get one, I'd imagine you will have to write your own. But I'll let someone better with QML answer that. ;)
-
@ambershark
QScrollView
is still in 2. Could you manage with that then? -
@ambershark said in QML Treeview:
Why they dropped it, you'd have to ask a Qt developer.
http://blog.qt.io/blog/2016/10/06/qt-quick-controls-2-1-and-beyond/
-
@JNBarchan ScrollView isn't really much help for a TreeView.
I don't understand how such a large, viral GUI toolkit like Qt is missing fundamental components like a TreeView.
This is really a bummer, and I don't really want to implement one myself, that's the job of Qt as a toolkit for me...Is it at least available in one of the next upcoming Qt releases?
-
@Magnus21
QTreeView
is derived fromQScrollView
, so there might have been a chance you were only using the latter's facilities. You'd be surprised how people might use a more complex component than they really need!To be clear, it's not Qt that is missing your
QTreeView
, it is Qt Quick (2). I am usingQTreeView
in a Qt application quite happily.I am not one of the Qt experts, but I suspect Qt Quick is concentrating on mobile support, and
QTreeView
is probably a bit "heavyweight" for what they want to support natively... -
-
You could still use the one from QQC1
import QtQuick.Controls 2.0 import QtQuick.Controls 1.4 as QQC1 Button {} //QQC2 button QQC1.TreeView{} // QQC1 tree view
-
@GrecKo I prefer to keep my app Quick Controls 2 only.
Mixing QC1 with QC2 is bad, since for example QC2 scale with the DPI while QC1 do not. Also QC1 would have a performance impact, so I would not consider that a solution. -
@Magnus21 You are absolutely right. Are Qt developers not interested in improving the Desktop version anymore at all??