当前位置:网站首页>Qt——如何在QWidget中设置阴影效果
Qt——如何在QWidget中设置阴影效果
2022-07-02 06:30:00 【代码海贼团船长】
介绍
这是一个用来设置QWidget控件及其子控件阴影效果的类。
父类
继承自:QGraphicsEffect
属性
blurRadius:qeal
模糊半径:可以使用 qreal blurRadius() const 和void setBlurRadius(qreal blurRadius)获取和设置当前属性的值,默认值是1。
color:QColor
设置阴影颜色:可以使用QColor color() const和void setColor(const QColor &color)来设置和获取当前属性的值,默认值是(QColor(63, 63, 63, 180))
offset : QPointF
这个属性保存以像素为单位的阴影偏移量。默认情况下,向右下方偏移量为8像素。偏移量是在设备坐标中给出的,这意味着它不受比例的影响。可以使用QPointF offset()const和void setOffset(const QPointF &ofs)来设置和获取当前属性的值。
xOffset : qreal
这个属性保存以像素为单位的阴影偏移量X。
yOffset : qreal
这个属性保存以像素为单位的阴影偏移量Y。
公有继承
virtual QRectF boundingRectFor(const QRectF &rect) const override
保护继承
virtual void draw(QPainter *painter) override
信号
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);

代码demo
边栏推荐
- c语言将字符串中的空格替换成%20
- Nacos 下载启动、配置 MySQL 数据库
- Matlab - autres
- Linux安装Oracle Database 19c
- 使用wireshark抓取Tcp三次握手
- Global and Chinese markets of tilting feeders 2022-2028: Research Report on technology, participants, trends, market size and share
- Matlab other
- Development of digital collection trading website development of metauniverse digital collection
- [blackmail virus data recovery] suffix Crylock blackmail virus
- 【无标题】
猜你喜欢

Honeypot attack and defense drill landing application scheme

c语言自定义类型——结构体,位段(匿名结构体,结构体的自引用,结构体的内存对齐)

File upload Labs

Implementation of bidirectional linked list (simple difference, connection and implementation between bidirectional linked list and unidirectional linked list)

sqli-labs第8关(布尔盲注)

sqli-labs(POST类型注入)

使用wireshark抓取Tcp三次握手

Generate database documents with one click, which can be called swagger in the database industry

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
随机推荐
实现双向链表(带傀儡节点)
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
Dip1000 implicitly tagged with fields
Web安全--核心防御机制
C language replaces spaces in strings with%20
Learning C
16: 00 interview, came out at 16:08, the question is really too
What are the platforms for selling green label domain names? What is the green label domain name like?
群辉 NAS 配置 iSCSI 存储
cve_ 2019_ 0708_ bluekeep_ Rce vulnerability recurrence
顺序表基本功能函数的实现
判断是否是数独
Programmer training, crazy job hunting, overtime ridiculed by colleagues deserve it
Gateway is easy to use
Benefits of ufcs of D
Linux二进制安装Oracle Database 19c
c语言自定义类型——结构体,位段(匿名结构体,结构体的自引用,结构体的内存对齐)
sqli-labs第1关
C language custom type enumeration, Union (clever use of enumeration, calculation of union size)
Minecraft空岛服开服