[Development] QTreeView: vertical bar between columns
volker.hilsheimer at qt.io
Tue May 17 19:44:13 CEST 2022
> On 17 May 2022, at 18:06, Laszlo Papp <lpapp at kde.org> wrote:
> On Tue, May 17, 2022 at 4:51 PM Laszlo Papp <lpapp at kde.org> wrote:
> What is required is a widget or mode of a widget that combines both abilities.
> QTreeView already sort of does that, although badly. Basically, a header makes it look like a table, but it is also a tree. That is why I think the feature request is valid. It should either not have a header or header formatting for this, and then you can argue body formatting is moot, or if it has header and header formatting, then the body formatting ought to be consistent.
> Just googled an image: https://docs.unity3d.com/uploads/Main/TreeViewAPI-0.png (Unity, fairly common software)
> They say "multiple columns". As far as I am concerned, a QTreeView is a special QTableView. You can see on the above image that it is column and row based and as a direct consequence, you have "cells" of data. It is just that the tree visual expand into the first column a bit more due to its graphical nature, but it eventually is column-based.
Well, the Unity thing is really not showing a lot of lines between the columns, does it? Other than in the header, which our header view does as well, because it is intended to show section headings. You can implement this with a bit of work using custom delegates, or even item widgets if you don’t care much about your memory footprint.
Anyway, I’ve jotted down some thoughts regarding API and implementation in the JIRA ticket at https://bugreports.qt.io/browse/QTBUG-103535. This will be a fair amount of work, but it can be a lot of fun, and there is very little risk of breaking existing code as long as the feature is not used.
More information about the Development