2

How do i set a custom background color for certain rows in a QFileSystemModel applied on a QTreeView?

Shinnok
  • 6,279
  • 6
  • 31
  • 44
  • could you place a small snap shot so that we can suggest some ideas. – Naruto Oct 14 '10 at 05:34
  • The qt example from http://doc.qt.nokia.com/4.7/itemviews-dirview-main-cpp.html should be enough. For eg. i want to set a custom background for rows with directories. – Shinnok Oct 14 '10 at 09:21

1 Answers1

1

you can use setData method and Qt::BackgroundColorRole to achieve that. This should work.

Kamil Klimek
  • 12,884
  • 2
  • 43
  • 58
  • 1
    Above answer doesn't work. QFileSystemModel rejects all calls to setData that is not of the role "Qt::EditRole". –  Jan 25 '11 at 00:13