Qt uses QMovie to load GIF images for dynamic wait windows. qtqmovie
Sometimes a background processing is required, but the background processing takes a long time and you need to be prompted to wait. You may wish to create a dynamic wait window. The specific implementation process is as follows:
1. Custom window class DlgWait (1) Add a dynamic GIF image to the resource and remember its size.
I upload a loading.gif image with a size of 100x100, as shown below:
SetWindowFlags (Qt: FramelessWindowHint); // setAttribute without Borders (Qt: WA_TranslucentBackground); // transparent background // int frmX = width () displayed in the center of the screen (); int frmY = height (); q1_topwidget w; int trim width = w. width (); int trim Height = w. height (); QPoint movePoint (Border width/2-frmX/2, border height/2-frmY/2); move (movePoint ); // load the gifimage QMovie * movie = new QMovie (":/img/loading"); ui-> lbl_gif-> setMovie (movie); movie-> start ();
2. Use this wait window
The effect is as follows: