Please nominate your Qt Champions for 2021! https://forum.qt.io/topic/132134/looking-for-the-2021-qt-champions
QTreeView with a different drawing scheme
swivelhead last edited by
I would like to have a widget similar to a QTreeView, but would allow me to draw things differently.
For one, I don't like how it drops down into the same column then you expand. I want it to go to the next column. I also would like to fix how it only shows the bold headers if you sort and there seems to be some sort of bug getting that to work.
In my current (and so far failing attempt) I have been wrestling with a subclass of QTreeView that completely overrides that drawRow method, but it has led me (however incorrectly) to pull from (literally; not inherit) several of the private classes of qtreeview, qabstractitemview, and qframe into my own private class for my subclass of QTreeView. Lately I have ran into a roadblock, where I may need to copy the entire QAbstractItemModelPrivate class to proceed.
(Before anyone asks, I'm copying the (parts of) the private classes into my custom private class instead of inheriting because certain members are needed in the .initialize() and .drawRow() methods and all of the Qt private classes contain the warning:
// W A R N I N G
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
// We mean it.)
Obviously, I'm starting to think I am doing things way wrong.
Is there something huge that I am missing about getting widgets to behave differently (however drastically) by altering their virtual classes like drawRow in QTreeView, or is it just not possible using Qt's classes?
Thanks for any clarity on this issue.