QGraphicsBlurEffect 会降低性能吗?
QGraphicsBlurEffect degrades the performance?
我正在 Qt5 中开发 GUI,在 QWidget
s 和 QFrame
s 上使用动画,我在 QFrame
上设置了模糊效果,因为我将 QFrame
设置为父级在我的 QWidget
中,我在 QWidget
上设置了 QPropertyAnimation
,这会根据操作增加或减少其大小。如果我删除在 QFrame
上设置的模糊效果,动画会顺利运行,但当我设置它时,它不会。所以我的问题是,QGraphicsEffects
会降低性能吗?
模糊效果有一些开销,具体取决于模糊半径、应用它的小部件和模糊提示。您可以将模糊提示设置为 QGraphicsBlurEffect::PerformanceHint
:
effect->setBlurHints(QGraphicsBlurEffect::PerformanceHint);
来自关于 QGraphicsBlurEffect::PerformanceHint
的 Qt 文档:
Indicates that rendering performance is the most important factor, at
the potential cost of lower quality.
所以如果你设置这个提示,性能会好很多。
我正在 Qt5 中开发 GUI,在 QWidget
s 和 QFrame
s 上使用动画,我在 QFrame
上设置了模糊效果,因为我将 QFrame
设置为父级在我的 QWidget
中,我在 QWidget
上设置了 QPropertyAnimation
,这会根据操作增加或减少其大小。如果我删除在 QFrame
上设置的模糊效果,动画会顺利运行,但当我设置它时,它不会。所以我的问题是,QGraphicsEffects
会降低性能吗?
模糊效果有一些开销,具体取决于模糊半径、应用它的小部件和模糊提示。您可以将模糊提示设置为 QGraphicsBlurEffect::PerformanceHint
:
effect->setBlurHints(QGraphicsBlurEffect::PerformanceHint);
来自关于 QGraphicsBlurEffect::PerformanceHint
的 Qt 文档:
Indicates that rendering performance is the most important factor, at the potential cost of lower quality.
所以如果你设置这个提示,性能会好很多。