一,设置工具栏图标大小的方法: 当前窗口设置图标大小的方法(统一设置,QAction没有设置图标大小的方法) this->setIconSize(QSize(width,height)); //this指的是当前的窗体 二:设置横向滑条的样式 效果图: 样式表
//中间白色区域的样式 QSlider::groove:horizontal { background-color: rgb(238, 238, 236); //中间白色区域的颜色设置 height: 7px; //中间白色区域的高度设置 border-radius: 3px; //白色区域的两边圆滑 } //灰色滑块的设置 QSlider::handle:horizontal { background-color: rgb(136, 138, 133); //设置滑块的颜色 width: 20px; //设置滑块的宽度 border-radius: 10px; //滑块的边角处理 margin: -15px 0; //滑块的高度可以通过此参数设置 } //设置滑块划过的区域的颜色 QSlider::sub-page:horizontal {
background-color: rgb(136, 138, 133); //设置划过区域的颜色为灰色 border-radius: 3px; //划过区域的边角处理 } 三:窗口透明的解决方法
对于QWidget如果设置 this->setWindowFlags(Qt::FramelessWindowHint);后,如果该类有父窗口的话,该窗口就会透明,否则不会透明。
如果要设置有父窗口时不透明,则设置:this->setWindowFlags(Qt::FramelessWindowHint|Qt::Window),或者重新绘制下背景图片,调用paintEvent()函数,注意是图片,填充色是没有效果的
经实践发现可以使用:this->setAutoFillBackground(true);设置自动填充背景后,窗口不会透明
注意:该函数一定要在界面显示出来后执行才会有效果,否则无效 |
|