qt框架为什么不会占用很高的cpu

qt框架是如何做到低cpu占用的,时刻绘制桌面图像不应该占用很多cpu吗

并没有时刻进行绘制,画图的paintEvent不会重复触发,只有某些情况触发,如调用update,或者切换窗口等才会触发,参考QT手册如下

[virtual protected] void QWidget::paintEvent(QPaintEvent *event)
This event handler can be reimplemented in a subclass to receive paint events passed in event.
A paint event is a request to repaint all or part of a widget. It can happen for one of the following reasons:
repaint() or update() was invoked,
the widget was obscured and has now been uncovered, or
many other reasons.

如有帮助,请采纳,谢谢。

这个涉及到程序线程的问题,低cpu那就线程少开,那就会导致程序运行慢;现在电脑的性能除非是大项目,小项目一般不用考虑CPU