background
-
Hi
Just put a Qlabel there and set the GIF via setPixmap
If you mean an animated gif, have a look at QMovie.
https://doc.qt.io/qt-5/qmovie.htmlYou 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);
-
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 formthe code i have written is
```
*this->setCentralWidget(ui->label);
QMovie movie = new QMovie(":/Images/7T9364v.gif");
ui->label->setMovie(movie);
movie->start();
ui->label->setScaledContents(true); -
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?