QGraphicsDropShadowEffect 类提供投影效果。 更多...
头: | #include <QGraphicsDropShadowEffect> |
CMake: |
find_package(Qt6 COMPONENTS Widgets REQUIRED)
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 (qreal d ) |
void | setOffset (qreal dx , qreal dy ) |
void | setOffset (const QPointF & ofs ) |
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 .
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 ) |
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 ().
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 ().
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 ) |
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 ) |
构造新 QGraphicsDropShadowEffect 实例。 parent 参数会被传递给 QGraphicsEffect 的构造函数。
[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 .
[signal]
void
QGraphicsDropShadowEffect::
colorChanged
(const
QColor
&
color
)
此信号被发射,每当效果的颜色改变时。 color 参数保持效果的新颜色。
注意: 通知程序信号对于特性 color .
[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 .
[虚拟]
QGraphicsDropShadowEffect::
~QGraphicsDropShadowEffect
()
销毁效果。
[override virtual]
QRectF
QGraphicsDropShadowEffect::
boundingRectFor
(const
QRectF
&
rect
) const
重实现: QGraphicsEffect::boundingRectFor (const QRectF &rect) const.
[override virtual protected]
void
QGraphicsDropShadowEffect::
draw
(
QPainter
*
painter
)
重实现: QGraphicsEffect::draw (QPainter *painter).