当前位置:网站首页>QT timer realizes dynamic display of pictures

QT timer realizes dynamic display of pictures

2022-07-05 09:56:00 Sunqk5665

This is achieved by timer “ The flying of butterflies ”

The main use is timer

1、 The process

Create a new one Widget, In the header file widget.h Add the declaration of timer in
 Insert picture description here
Add... To the design interface l Two lable, One lable Add a picture of a butterfly spreading its wings , the other one lable Add a picture of a butterfly closing its wings , Ensure two lable It is the same size as the two pictures , In this way, the final effect is the best
 Insert picture description here

And then in widget.cpp Set the timer and reconstruct the timing function in the source file
 Insert picture description here
 Insert picture description here
Here we want to realize the interval switching and moving of pictures , To set two timers , One is used to control the picture display , The other is used to control the frontal coordinate movement of the picture .

2、 effect

Watch the running video below

adopt Qt Realization “ Butterfly flies ”

原网站

版权声明
本文为[Sunqk5665]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140535206367.html