当前位置:网站首页>QT -- how to set shadow effect in QWidget
QT -- how to set shadow effect in QWidget
2022-07-02 08:50:00 【Code pirate captain】
Introduce
This is a tool to set up QWidget Control and its child control shadow effect class .
Parent class
Inherited from :QGraphicsEffect
attribute
blurRadius:qeal
Blur radius : have access to qreal blurRadius() const and void setBlurRadius(qreal blurRadius) Get and set the value of the current property , The default value is 1.
color:QColor
Set the shadow color : have access to QColor color() const and void setColor(const QColor &color) To set and get the value of the current property , The default value is (QColor(63, 63, 63, 180))
offset : QPointF
This attribute holds the shadow offset in pixels . By default , Lower right offset is 8 Pixels . The offset is given in the equipment coordinates , This means that it is not affected by proportion . have access to QPointF offset()const and void setOffset(const QPointF &ofs) To set and get the value of the current property .
xOffset : qreal
This attribute holds the shadow offset in pixels X.
yOffset : qreal
This attribute holds the shadow offset in pixels Y.
public inheritance
virtual QRectF boundingRectFor(const QRectF &rect) const override
Protection succession
virtual void draw(QPainter *painter) override
The signal
void blurRadiusChanged(qreal blurRadius)
void colorChanged(const QColor &color)
void offsetChanged(const QPointF &offset)
QGraphicsDropShadowEffect*mpGraphicsDropShadowEffect= new QGraphicsDropShadowEffect(this);
mpGraphicsDropShadowEffect->setColor(QColor(100,100,100,100));
mpGraphicsDropShadowEffect->setBlurRadius(2);
mpGraphicsDropShadowEffect->setOffset(2.5);
ui->label->setGraphicsEffect(mpGraphicsDropShadowEffect);
Code demo
边栏推荐
- web安全--逻辑越权
- Hcia - Application Layer
- Minecraft group service opening
- D interface and domain problems
- Loadbalancer dynamically refreshes Nacos server
- Sentinel 简单使用
- Detailed explanation of NIN network
- kubernetes部署loki日志系统
- Classes and objects (instantiation of classes and classes, this, static keyword, encapsulation)
- Aneng logistics' share price hit a new low: the market value evaporated by nearly 10 billion yuan, and it's useless for chairman Wang Yongjun to increase his holdings
猜你喜欢
随机推荐
Kubernetes deploys Loki logging system
Analysis and solution of a classical Joseph problem
Minecraft模组服开服
History of Web Technology
Installing Oracle database 19C RAC on Linux
[blackmail virus data recovery] suffix Rook3 blackmail virus
Move a string of numbers backward in sequence
C Gaode map obtains the address according to longitude and latitude
Sqli labs level 1
C language custom types - structure, bit segment (anonymous structure, self reference of structure, memory alignment of structure)
C language custom type enumeration, Union (clever use of enumeration, calculation of union size)
File upload and download performance test based on the locust framework
[blackmail virus data recovery] suffix Crylock blackmail virus
[flask] ORM one-to-one relationship
Viewing JS array through V8
Sentinel easy to use
Luogu greedy part of the backpack line segment covers the queue to receive water
Openshift build image
HCIA—数据链路层
libusb的使用