Dear visitor, welcome to QtForum.org.
If this is your first visit here, please read the Help. It explains in detail how this page works.
To use all features of this page, you should consider registering.
Please use the registration form, to register here or read more information about the registration process.
If you are already registered, please login here.

image on pushbutton on Qt4.4.3

Hi friends,
It will be very helpful if anyone can provide an solution to my query.
I am working on redhat enterprise 4 version.
I have developed an application on Qt3.3.4.
I have used image on the pushbutton background in that application.sample code: QPushButton *pb = new QPushButton(this, "MyButton");
QImage img;
if(img.load(IMG_PATH"pb_bg.png"))
{ pb->setBackgroundPixmap(img); }
else
{ // set back ground and foreground color for button. }
This code is working fine for Qt 3.3.4
But when i port this application on Qt 4.4.3 than it is not displaying the image.
Sample code: QPushButton *pb = new
QPushButton(this, "MyButton");
QImage img;
QPixmap pix;
if(img.load(IMG_PATH"pb_bg.png"))
{ pix = QPixmap::fromImage (img);
pb->setPaletteBackgroundPixmap(pix); }
else
{ // set back ground and foreground color for button. }

On the execution of above code snippet, it gives a black background on the button as an image.
One more thing i can not use QPushButton::setIcon API as i need text over the image.
that is image on the pushbutton should apear as an overlay.
I found out one strange thing that the API "setPaletteBackgroundPixmap()" is working fine for QDialog but for pushbutton.

Thanks a lot in advance.Reev--
A bug in debugger's heart.

Every step you take, brings your destination near or far. Depends whether you are going in same direction or opposite.