CQGUI框架之阴影圆角窗口实现

CQGUI开发环境::
Microsoft Visual Studio 2019
Qt5.15.1
步骤如下::
一、继承关系
class LoginPanel : public QDialog
二、窗口属性
setAttribute(Qt::WA_TranslucentBackground); //设置顶层面板背景透明
setWindowFlags(Qt::FramelessWindowHint); //设置无边框
setContentsMargins(10, 10, 10, 10);
Qt::WA_TranslucentBackground Indicates that the widget should have a translucent background, i.e., any non-opaque regions of the widgets will be translucent because the widget will have an alpha channel. Setting this flag causes WA_NoSystemBackground to be set. On Windows the widget also needs the Qt::FramelessWindowHint window flag to be set. This flag is set or cleared by the widget’s author.

三、设置阴影效果
auto *defaultShadow = new QGraphicsDropShadowEffect();
defaultShadow->setBlurRadius(10.0);
defaultShadow->setColor(QColor(0, 0, 0, 160));
defaultShadow->setOffset(0, 0);
_loginMainFrm->setGraphicsEffect(defaultShadow);
四、设置样式
QFrame#loginMainFrm>QFrame#leftFrame{
background:rgba(255,255,255,0.9);
border-top-left-radius:6px;
border-top-right-radius:0px;
border-bottom-right-radius:0px;
border-bottom-left-radius:6px;
}
五、事件响应
protected:
void mousePressEvent(QMouseEvent *e) override ;
void mouseReleaseEvent(QMouseEvent e) override ;
void mouseMoveEvent(QMouseEvent e) override ;
void closeEvent(QCloseEvent e) override ;
bool event(QEvent
e) override ;
protected:
bool eventFilter(QObject
o, QEvent
e) override;
USB Microphone https://www.soft-voice.com/
Wooden Speakers https://www.zeshuiplatform.com/
亚马逊测评 www.yisuping.cn
深圳网站建设www.sz886.com

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值