I have a multi hierarchy QTreeView (currently 3 levels, will be more depends),
I created 3 different delegates (delegate A/B/C) for each level
But how do I apply the delegate to the QTreeView properly?
The following pic shows what I want:
>Row 0 -------------------- delegate A
>Row 1 -------------------- delegate A
^Row 2 -------------------- delegate A
^Row 20 ----------------- delegate B
Row 200 -------------- delegate C
Row 201 -------------- delegate C
Row 202 -------------- delegate C
^Row 21 ----------------- delegate B
Row 210 -------------- delegate C
Row 211 -------------- delegate C
Row 212 -------------- delegate C
>Row 0 -------------------- delegate A
>Row 1 -------------------- delegate A
^Row 2 -------------------- delegate A
^Row 20 ----------------- delegate B
Row 200 -------------- delegate C
Row 201 -------------- delegate C
Row 202 -------------- delegate C
^Row 21 ----------------- delegate B
Row 210 -------------- delegate C
Row 211 -------------- delegate C
Row 212 -------------- delegate C
To copy to clipboard, switch view to plain text mode
This function:
QAbstractItemView::setItemDelegateForRow(int row, QAbstractItemDelegate * delegate);
With this function, I can only assign the delegate for the first level of the TreeView.
And its children (level 2, level 3) are gonna share the same delegate with level 1
How do I assign the delegate B to Row 20 and Row 21?
How do I assign the delegate C to Row 200, Row 201, Row 202......
Bookmarks