当前位置:网站首页>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
边栏推荐
猜你喜欢
Googlenet network explanation and model building
Sqli labs level 1
Openfeign is easy to use
Minecraft module service opening
Nacos download, start and configure MySQL database
c语言将字符串中的空格替换成%20
Kubernetes deploys Loki logging system
File upload Labs
Installing Oracle database 19C RAC on Linux
HCIA - data link layer
随机推荐
web安全--逻辑越权
Network security - summary and thinking of easy-to-use fuzzy tester
C Baidu map, Gaode map, Google map (GPS) longitude and latitude conversion
Sqli labs level 1
IP protocol and IP address
选择排序和插入排序
Minecraft group service opening
Linux安装Oracle Database 19c RAC
First week of JS study
Sentinel 简单使用
汉诺塔问题的求解与分析
Data asset management function
STM32 new project (refer to punctual atom)
使用递归函数求解字符串的逆置问题
Move a string of numbers backward in sequence
C# 将网页保存为图片(利用WebBrowser)
IP协议与IP地址
C# 调用系统声音 嘀~
Judge whether it is Sudoku
C nail development: obtain all employee address books and send work notices