Results 1 to 3 of 3

Thread: QIcons

  1. #1
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Question QIcons

    I am trying to create a QIcon for my toolbar from a bitmap file. I have the bitmap stored as a .h file, but I can only see how to set the icon using a QPixmap which will convert the image to 32-bit when I need to keep it as the black-and-white bitmap that it already is. Any help would be great! Thanks!

  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: QIcons

    Have you tried QBitmap::fromData()?

  3. The following user says thank you to wysota for this useful post:

    ToddAtWSU (16th August 2006)

  4. #3
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Cool Re: QIcons

    I tried QBitmap::fromData( ) and it worked perfectly. The only problem I had was I am using an XBM that I saved as a .h file, but I had to use the QImage::Format of QImage::Format_MonoLSB even though the documentation says to just use QImage::Format_Mono. When I didn't use the LSB one, my image was divided vertically into thirds, and each third was horizontally reversed. Thanks for your help Wysota!

Similar Threads

  1. Problems declaring global QIcons
    By SkripT in forum Qt Programming
    Replies: 5
    Last Post: 7th March 2006, 19:08

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.