PDA

View Full Version : Overriding QListView painting



efegea
29th November 2008, 15:45
I need to override QListView because I need custom painting. I need to make the background transparent and without any frame, and paint a custom background using a QPixmap. I also need to paint the icons (QListView::IconMode) my own way, but for that I'm implementing a custom QItemDelegate.

What functions should I override from QListView? I've searched into the documentation but can't find the function, inherited or not, that draws the background.

wysota
29th November 2008, 16:56
You don't have to change anything in the listview. You only need to provide your own delegate and maybe change the palette of the listview's viewport to make it transparent (or set it to your pixmap).

efegea
29th November 2008, 17:16
I got another problem: I didn't specify that I'm using the QListView on a QGraphicsView, so it's a QGraphicsProxyWidget.

I tried to set the background to transparent using stylesheets, but no luck, it looks grey :(

EDIT: solved, using Qt::WA_NoSystemBackground

EDIT2: nevermind, I had an the image also on my skin file