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

详细说明

Colorize 效果用color() 的色调渲染源。可以使用setColor() 函数修改颜色。

默认情况下,颜色为淡蓝色(QColor(0, 0, 192))。

另请参阅 QGraphicsDropShadowEffect,QGraphicsBlurEffect, 和QGraphicsOpacityEffect

属性文档

color : QColor

该属性用于保存效果的颜色。

默认情况下,颜色为淡蓝色(QColor(0, 0, 192))。

访问功能:

QColor color() const
void setColor(const QColor &c)

Notifier 信号:

void colorChanged(const QColor &color)

strength : qreal

此属性表示效果的强度。

默认情况下,强度为 1.0。强度 0.0 表示无效果,1.0 表示完全着色。

访问功能:

qreal strength() const
void setStrength(qreal strength)

Notifier 信号:

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 属性的通知信号。

© 2025 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.