Results 1 to 4 of 4

Thread: Hide a QIcon in a QListWidget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2010
    Location
    Washington, PA
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Hide a QIcon in a QListWidget

    This will work. Seems to me that flip-flopping the icons back and forth would create some overhead. Especially when the actual .png file is copied into memory. The .png file would then be deleted when I set the transparent icon. Whenever a change is made, and I reset the .png icon, the file is again copied into memory and reset in the item. Seems like it would be a little nicer if the icon itself had a hide method, or the pixmap returned as a reference. I'm sure this could cause problems if someone didn't know what they were doing with the referenced icon, but still...

    Thanks for the help! I did this same thing, just didn't fill the pixmap with Qt::transparent.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Hide a QIcon in a QListWidget

    Quote Originally Posted by KineticArc View Post
    This will work. Seems to me that flip-flopping the icons back and forth would create some overhead. Especially when the actual .png file is copied into memory. The .png file would then be deleted when I set the transparent icon. Whenever a change is made, and I reset the .png icon, the file is again copied into memory and reset in the item.
    That's why I said to use QPixmapCache.

    Seems like it would be a little nicer if the icon itself had a hide method, or the pixmap returned as a reference. I'm sure this could cause problems if someone didn't know what they were doing with the referenced icon, but still...
    Implement a custom delegate that will simply not draw the icon if you don't want it to or do things the proper way - using the model approach.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Add pictures svg in QIcon
    By giorgik in forum Qt Programming
    Replies: 2
    Last Post: 7th September 2010, 09:00
  2. Qicon
    By shihao in forum Qt Programming
    Replies: 11
    Last Post: 15th March 2010, 13:23
  3. Change QIcon
    By Diph in forum Qt Programming
    Replies: 2
    Last Post: 2nd August 2009, 07:29
  4. How to get the QIcon fileneme in use.
    By gt.beta2 in forum Newbie
    Replies: 1
    Last Post: 25th February 2009, 15:30
  5. Replies: 2
    Last Post: 31st May 2006, 21:52

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.