1 Attachment(s)
QTreeView -- Alternating Row Colors Oddity
I have a QTreeView displaying data from a custom model. Basically i turn on alternating row colors to make everything readable. However the alternating row colors do not paint all colums, only columns with data or where a model item has been created. Is there anyway to get that to paint across all columns regardless? In large trees its really distracting and ugly. This screen shot is using Qt 4.3.2 and QSA 1.2.2 btw.
Thanks,
Chuck
Re: QTreeView -- Alternating Row Colors Oddity
Are you sure each level of the model has the same number of columns? If you use QStandardItemModel it is important to call setColumnCount() with the same value for each level. For a custom model your columnCount() should return the same value for each index.
Re: QTreeView -- Alternating Row Colors Oddity
That was it. I reimplemented columnCount() in my custom model to return the same column count for all indexes like you suggested and it now correctly paints across the treeview.
Thanks,
Chuck
:D