0

I am writing a simple file browser app with Nokia Qt4.7 on Symbian^3 platform. I can display the directory/file list in the listview widget using QFileSystemModel. But I want to customize the list view item. And I am using QItemDelegate to do the trick overriding sizHint and paint functions. I want to display a checkbox in the end of every item (ListMode) or in the right down corder of the icon(IconMode). How can I do it? Thanks.

catinred
  • 329
  • 4
  • 12

2 Answers2

2

I'd suggest you to reimplement QItemDelegate::paint function and use QStylePainter and use QStylePainter::drawControl to render checkbox element. Depending on the mode you can vary your painting.

Barbaris
  • 1,256
  • 7
  • 7
  • Is there any example code about reimplementing QItemDelegate::paint and QStylePainter::drawControl ? – catinred Apr 22 '11 at 02:15
  • yes, the method documentation itself has some small code. Also you can check out examples/itemviews/pixelator in Qt source code directory. – Barbaris Apr 22 '11 at 11:40
0

You can also do this using QML . Styling rows is much easier in QML. To be more specific your Model will still be c++ . Only the list can be in QML.

Abhijith
  • 2,592
  • 5
  • 18
  • 30