当前位置:网站首页>QT refresh UI interface problem
QT refresh UI interface problem
2022-07-28 15:32:00 【Flying_】
When performing the settext() After the operation , If there is a dead loop or processing that takes up a lot of main thread time , Then the interface will not be updated immediately , The interface will only be updated after the logic is processed , So what can I do to update the interface immediately ?
The first one is : Put the operation that takes up a lot of resources of the main thread into another thread to execute , This will not affect the interface update operation of the main thread
The second kind : perform settext() Then directly execute once qApp->processEvent() In this way, the interface can be updated immediately
It needs to be said that the update interface is waiting for execution a. exec() Before you can update , And in the a. exec() In fact, it is also processEvent() function
Ui The update of can only be in the main thread
Although the interface is updated after the logic is executed , Yes a. exec() Then the interface will be updated , But there is a special control that will update the interface immediately , That is the progress bar control QProcessBar Medium setvalue() function , This will update the interface immediately , And if the setvalue() There was an operation to update other controls , You can also update the interface immediately , Estimated progress bar setvalue() Is also implemented qApp->processEvent() To update the interface immediately
边栏推荐
猜你喜欢

DataTables warning: table id=campaigntable - cannot reinitialize datatable. solve

Have you ever used the single merchant mall, which is smooth enough to make people feel numb?

JOGY-61电压继电器

Grpc protocol buffer
新版数据同步问题
软件测试的流程规范有哪些?具体要怎么做?

What are the functions to be added in crmeb pro2.2?

Classic Dijkstra and the longest way

【通道注意力机制】SENet

crmeb 标准版window+phpstudy8安装教程(二)
随机推荐
Summary of common redis commands (self provided)
Compilation learning
3540. Binary search tree
DAY:7/11
I heard that many merchants of crmeb have added the function of planting grass?
Jwy-32b voltage relay
Knowledge payment open source system
手把手带你编写一个规范的字符设备驱动
4.8 HD-GR GNSS导航软件源码
Here comes the full open source free customer service system
How to set some app application icons on the iPhone Apple phone that you don't want others to see? How to hide the app application settings on the mobile desktop so that they can be used normally afte
RY-D1/1电压继电器
Write a standard character device driver with your hands
Opencv - draw mask images of multiple instances
Introduction to grpc
QCustomPlot绘图工具常用方法
树上启发式合并简单题
JY-7GA/1电压继电器
Leetcode - number of operations, non repeating numbers, diagonal traversal, Joseph Ring
解决pycharm使用powershell出错问题