QGraphicsDropShadowEffect 类

QGraphicsDropShadowEffect 类提供投影效果。 更多...

头: #include <QGraphicsDropShadowEffect>
CMake: find_package(Qt6 REQUIRED COMPONENTS Widgets)
target_link_libraries(mytarget PRIVATE Qt6::Widgets)
qmake: QT += widgets
继承: QGraphicsEffect

特性

公共函数

QGraphicsDropShadowEffect (QObject * parent = nullptr)
virtual ~QGraphicsDropShadowEffect ()
qreal blurRadius () const
QColor color () const
QPointF offset () const
qreal xOffset () const
qreal yOffset () const

重实现公共函数

virtual QRectF boundingRectFor (const QRectF & rect ) const override

公共槽

void setBlurRadius (qreal blurRadius )
void setColor (const QColor & color )
void setOffset (const QPointF & ofs )
void setOffset (qreal dx , qreal dy )
void setOffset (qreal d )
void setXOffset (qreal dx )
void setYOffset (qreal dy )

信号

void blurRadiusChanged (qreal blurRadius )
void colorChanged (const QColor & color )
void offsetChanged (const QPointF & offset )

重实现保护函数

virtual void draw (QPainter * painter ) override

详细描述

投影效果按投影渲染源。修改投影的颜色可以使用 setColor () function. The drop shadow offset can be modified using the setOffset () function and the blur radius of the drop shadow can be changed with the setBlurRadius () 函数。

By default, the drop shadow is a semi-transparent dark gray ( QColor (63, 63, 63, 180)) shadow, blurred with a radius of 1 at an offset of 8 pixels towards the lower right. The drop shadow offset is specified in device coordinates.

另请参阅 QGraphicsBlurEffect , QGraphicsColorizeEffect ,和 QGraphicsOpacityEffect .

特性文档编制

blurRadius : qreal

This property holds the blur radius in pixels of the drop shadow.

Using a smaller radius results in a sharper shadow, whereas using a bigger radius results in a more blurred shadow.

By default, the blur radius is 1 pixel.

访问函数:

qreal blurRadius () const
void setBlurRadius (qreal blurRadius )

通知程序信号:

void blurRadiusChanged (qreal blurRadius )

另请参阅 color () 和 offset ().

color : QColor

This property holds the color of the drop shadow.

By default, the drop color is a semi-transparent dark gray ( QColor (63, 63, 63, 180)).

访问函数:

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

通知程序信号:

void colorChanged (const QColor & color )

另请参阅 offset () 和 blurRadius ().

offset : QPointF

This property holds the shadow offset in pixels.

By default, the offset is 8 pixels towards the lower right.

The offset is given in device coordinates, which means it is unaffected by scale.

访问函数:

QPointF offset () const
void setOffset (const QPointF & ofs )
void setOffset (qreal dx , qreal dy )
void setOffset (qreal d )

通知程序信号:

void offsetChanged (const QPointF & offset )

另请参阅 xOffset (), yOffset (), blurRadius (),和 color ().

xOffset : qreal

This property holds the horizontal shadow offset in pixels.

By default, the horizontal shadow offset is 8 pixels.

访问函数:

qreal xOffset () const
void setXOffset (qreal dx )

通知程序信号:

void offsetChanged (const QPointF & offset )

另请参阅 yOffset () 和 offset ().

yOffset : qreal

This property holds the vertical shadow offset in pixels.

By default, the vertical shadow offset is 8 pixels.

访问函数:

qreal yOffset () const
void setYOffset (qreal dy )

通知程序信号:

void offsetChanged (const QPointF & offset )

另请参阅 xOffset () 和 offset ().

成员函数文档编制

QGraphicsDropShadowEffect:: QGraphicsDropShadowEffect ( QObject * parent = nullptr)

构造新 QGraphicsDropShadowEffect 实例。 parent 参数会被传递给 QGraphicsEffect 的构造函数。

[虚拟] QGraphicsDropShadowEffect:: ~QGraphicsDropShadowEffect ()

销毁效果。

[signal] void QGraphicsDropShadowEffect:: blurRadiusChanged ( qreal blurRadius )

This signal is emitted whenever the effect's blur radius changes. The blurRadius parameter holds the effect's new blur radius.

注意: 通知程序信号对于特性 blurRadius .

[override virtual] QRectF QGraphicsDropShadowEffect:: boundingRectFor (const QRectF & rect ) const

重实现: QGraphicsEffect::boundingRectFor(const QRectF &rect) const .

[signal] void QGraphicsDropShadowEffect:: colorChanged (const QColor & color )

此信号被发射,每当效果的颜色改变时。 color 参数保持效果的新颜色。

注意: 通知程序信号对于特性 color .

[override virtual protected] void QGraphicsDropShadowEffect:: draw ( QPainter * painter )

重实现: QGraphicsEffect::draw (QPainter *painter).

[signal] void QGraphicsDropShadowEffect:: offsetChanged (const QPointF & offset )

This signal is emitted whenever the effect's shadow offset changes. The offset parameter holds the effect's new shadow offset.

注意: 通知程序信号对于特性 offset 。通知程序信号对于特性 xOffset 。通知程序信号对于特性 yOffset .