当前位置:网站首页>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
边栏推荐
- C # save web pages as pictures (using WebBrowser)
- Npoi export word font size correspondence
- OpenShift 部署应用
- Minecraft插件服开服
- Qt——如何在QWidget中设置阴影效果
- Minecraft group service opening
- commands out of sync. did you run multiple statements at once
- Analysis and solution of a classical Joseph problem
- Introduction to the basic concept of queue and typical application examples
- OpenFeign 简单使用
猜你喜欢

kubeadm部署kubernetes v1.23.5集群

Data asset management function

Openfeign facile à utiliser

zipkin 简单使用

Web安全--核心防御机制

TCP/IP—传输层

k8s入门:Helm 构建 MySQL

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

C language replaces spaces in strings with%20

Minecraft install resource pack
随机推荐
Concise analysis of redis source code 11 - Main IO threads and redis 6.0 multi IO threads
Web security -- core defense mechanism
C# 高德地图 根据经纬度获取地址
Benefits of ufcs of D
Data asset management function
Minecraft空岛服开服
Minecraft群組服開服
Find the node with the smallest value range in the linked list and move it to the front of the linked list
C# 将网页保存为图片(利用WebBrowser)
Openshift container platform community okd 4.10.0 deployment
File upload Labs
History of Web Technology
Linux安装Oracle Database 19c
NPOI 导出Word 字号对应
OpenShift 容器平台社区版 OKD 4.10.0部署
Sqli labs level 1
C language custom type enumeration, Union (clever use of enumeration, calculation of union size)
Dip1000 runaway
commands out of sync. did you run multiple statements at once
KubeSphere 虚拟化 KSV 安装体验