简体   繁体   English

QGraphicsBlurEffect是否会降低性能?

[英]QGraphicsBlurEffect degrades the performance?

I am developing GUI in Qt5 with animation on QWidget s and QFrame s, I have set blur effect on QFrame as I set QFrame as a parent of few of my QWidget s and I set QPropertyAnimation on QWidget which increases and decreases its size depending upon action. 我正在Qt5中开发带有QWidgetQFrame的动画的GUI,我在QFrame上设置了模糊效果,因为我将QFrame设置为我的几个QWidget的父级,并且在QWidget上设置了QPropertyAnimation ,它根据动作增加或减小其大小。 If I remove blur effect set on QFrame animation works smoothly but when I set it it doesn't. 如果删除QFrame动画上设置的模糊效果,效果会很好,但设置时效果却QFrame So my question is, is QGraphicsEffects degrades the performance? 所以我的问题是, QGraphicsEffects会降低性能?

The blur effect has some overhead depending on the blur radius, the widget it is applied to and the blur hints. 模糊效果会产生一些开销,具体取决于模糊半径,应用于其的小部件以及模糊提示。 You can set the blur hint to QGraphicsBlurEffect::PerformanceHint : 您可以将模糊提示设置为QGraphicsBlurEffect::PerformanceHint

effect->setBlurHints(QGraphicsBlurEffect::PerformanceHint);

From the Qt documentation about QGraphicsBlurEffect::PerformanceHint : 从有关QGraphicsBlurEffect::PerformanceHint的Qt文档中:

Indicates that rendering performance is the most important factor, at the potential cost of lower quality. 表示渲染性能是最重要的因素,但可能会降低质量。

So if you set this hint, the performance would be much better. 因此,如果设置了此提示,性能将会更好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM