Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
someone please tell me that how to set a gif image on my centralwidget
Just put a Qlabel there and set the GIF via setPixmap
If you mean an animated gif, have a look at QMovie.
You can also set it to central with
QPixmap pix(":/test.gif"); // note this is from an ressource file QLabel *label = new QLabel; label->setPixmap(pix); label->setScaledContents(true); setCentralWidget(label);
Thanks alot sir
Ah!! sir one more thing i want set an animated gif on the background and i was able to do it with the help of qmovie on qlabel but when i want to add a pushbutton or anything else it doesn't appear on the screen
after running i got this
you see there is no pushbutton on main form
the code i have written is
QMovie movie = new QMovie(":/Images/7T9364v.gif");
Kent-Dorfman last edited by Kent-Dorfman
Think about what would be required to allow pushbuttons over top of an animated image. every time the background image frame is updated, all the higher z-order widgets would need to be checked and potentially repainted. From a programmatic perspective I would avoid adding widgets over top of an animation.
You also need to consider that the animation and buttons are part of the same layout. If you really want buttons on an animation, shouldn't those buttons be children of the image, instead of peers in the parent layout?