QGraphicsColorizeEffect Class
QGraphicsColorizeEffect 类提供了一种着色效果。更多内容...
| 头文件: | #include <QGraphicsColorizeEffect> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
| qmake: | QT += widgets |
| 继承自: | QGraphicsEffect |
属性
公共函数
| QGraphicsColorizeEffect(QObject *parent = nullptr) | |
| virtual | ~QGraphicsColorizeEffect() |
| QColor | color() const |
| qreal | strength() const |
公共槽位
| void | setColor(const QColor &c) |
| void | setStrength(qreal strength) |
信号
| void | colorChanged(const QColor &color) |
| void | strengthChanged(qreal strength) |
重新实现的受保护函数
| virtual void | draw(QPainter *painter) override |
另请参阅 QGraphicsDropShadowEffect 、QGraphicsBlurEffect 和QGraphicsOpacityEffect 。
属性文档
color : QColor
该属性用于指定特效的颜色。
默认情况下,颜色为浅蓝色(QColor (0, 0, 192))。
访问函数:
| QColor | color() const |
| void | setColor(const QColor &c) |
通知信号:
| void | colorChanged(const QColor &color) |
strength : qreal
该属性控制效果的强度。
默认情况下,强度值为 1.0。强度值为 0.0 表示无效果,而 1.0 表示完全着色。
访问函数:
| qreal | strength() const |
| void | setStrength(qreal strength) |
通知信号:
| void | strengthChanged(qreal strength) |
成员函数文档
QGraphicsColorizeEffect::QGraphicsColorizeEffect(QObject *parent = nullptr)
创建一个新的 QGraphicsColorizeEffect 实例。parent 参数将传递给QGraphicsEffect 的构造函数。
[virtual noexcept] QGraphicsColorizeEffect::~QGraphicsColorizeEffect()
消除该效果。
[signal] void QGraphicsColorizeEffect::colorChanged(const QColor &color)
每当效果的颜色发生变化时,都会触发此信号。color 参数存储了效果的新颜色。
注意: 这是属性color的通知 信号。
[override virtual protected] void QGraphicsColorizeEffect::draw(QPainter *painter)
重写了:QGraphicsEffect::draw(QPainter *painter)。
[signal] void QGraphicsColorizeEffect::strengthChanged(qreal strength)
每当 `setStrength()` 更改“着色强度”属性时,都会触发此信号。`strength ` 包含着色效果的新强度值。
注意: 这是属性strength 的通知器 信号。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.
