Results 1 to 3 of 3

Thread: Overriding QListView painting

  1. #1
    Join Date
    Oct 2008
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Overriding QListView painting

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Overriding QListView painting

    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).

  3. #3
    Join Date
    Oct 2008
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Overriding QListView painting

    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
    Last edited by efegea; 29th November 2008 at 17:48.

Similar Threads

  1. QListView word wrap
    By serega in forum Qt Programming
    Replies: 17
    Last Post: 30th August 2007, 03:13
  2. how to corss compile for windows in Linux
    By safknw in forum Qt Programming
    Replies: 24
    Last Post: 13th May 2006, 05:23

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.