PDA

View Full Version : QIcons



ToddAtWSU
14th August 2006, 21:58
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!

wysota
16th August 2006, 09:19
Have you tried QBitmap::fromData()?

ToddAtWSU
16th August 2006, 13:11
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! :D