Qt uses QMovie to load GIF images for dynamic wait windows. qtqmovie

Source: Internet
Author: User

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.