I'm creating a QProxyStlye and would like to align the first header column with the items in the column. Normally the first column starts with (0,0) and the items is offset by the width of a possible branch indicator (red square in the image).
Asked
Active
Viewed 347 times
0
-
http://doc.qt.io/qt-5/qtreeview.html#rootIsDecorated-prop - false – Dmitry Sazonov Feb 26 '16 at 08:19
-
@SaZ I need the branch indicator space to draw indicators but I want to change the alignment of the header. In the final style it would look great, not so with the Windows style. – TheOneRing Feb 26 '16 at 08:24
-
Ok, now I understand. Simple way is to inherit `QHeaderView` and override `paintSection` method. I'm not sure, that it is possible with delegates. If you really want to do this with `QProxyStyle` then you may research Qt code of `paintSection` method and find, what styles you need to reimplement. – Dmitry Sazonov Feb 26 '16 at 08:29
-
Currently I tend to this ugly solution `if(hopt->section == 0){ // TODO: get width of a branch indicator rect.adjust(30,0,0,0); }` – TheOneRing Feb 26 '16 at 09:05
1 Answers
0
Create custom delegate for QHeaderView
, override paint method.

Dmitry Sazonov
- 8,801
- 1
- 35
- 61

jonezq
- 344
- 1
- 5