I am working in Qt on Mac OSX. I have set a thumbnail image on a QPushbutton. Then I want to apply a 2nd image over the thumbnail image on mouse hover event. I have tried this, but on mouse hover event my first image is hidden and only the 2nd image appears. I want both of the images at a same time on mouse hover. I have attached an image of what I want to do. In this, the 1st image is car image and the 2nd one is a PLAY image (white triangle in circle).
If anybody have any idea of it, please let me know.
Just create one more image which will have first and second images and set it to your pushButton when user hover the button.
If you want to do this dynamically, you can add new image to your old image. You can achieve this with QPainter
. You should draw on image something like this:
QPixmap base, second; // come from your code
QPixmap result(200, 200);
QPainter painter(&result);
painter.drawPixmap(0, 0, base);
painter.drawPixmap(100, 0, second);
Now result
contains both images.