QT - 制作窗口圆角

来源:互联网 发布:淘宝爆款是什么意思 编辑:程序博客网 时间:2024/05/23 21:47

一、设置窗口属性

setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint);setAttribute(Qt::WA_TranslucentBackground);

二、使用qss添加圆角

#titleWnd{background-color:gray;border-top-left-radius:5px;border-top-right-radius:5px;}#mainWnd{background-color:#aaaaaa;border-bottom-left-radius:5px;border-bottom-right-radius:5px;}

titleWnd是我的标题容器QWidget,左上角和右上角设置圆角

mainWnd是我的内容容器QWidget,左下角和右下角设置圆角


三、效果如下:




0 0
原创粉丝点击