当前位置:网站首页>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
边栏推荐
- Solid principle: explanation and examples
- Installing Oracle database 19C RAC on Linux
- 小米电视不能访问电脑共享文件的解决方案
- Tensorflow2 keras 分类模型
- Luogu greedy part of the backpack line segment covers the queue to receive water
- D interface and domain problems
- Nacos download, start and configure MySQL database
- Judge whether it is Sudoku
- Network security - summary and thinking of easy-to-use fuzzy tester
- web安全--逻辑越权
猜你喜欢
随机推荐
Linux二进制安装Oracle Database 19c
Nacos 下载启动、配置 MySQL 数据库
Linux安装Oracle Database 19c RAC
文件上传-upload-labs
Installing Oracle database 19C RAC on Linux
Programmer training, crazy job hunting, overtime ridiculed by colleagues deserve it
Synchronize files using unison
ICMP协议
Pointer initialization
Openfeign is easy to use
Qt的connect函数和disconnect函数
Finishing the interview essentials of secsha system!!!
选择排序和插入排序
使用递归函数求解字符串的逆置问题
C # save web pages as pictures (using WebBrowser)
sqli-labs第8关(布尔盲注)
Gateway 简单使用
gocv图片裁剪并展示
Openshift container platform community okd 4.10.0 deployment
Function ‘ngram‘ is not defined









