Qt5样式表

在界面ui文件中设置各个控件的样式表:
1.在QGroupBox中设置样式表:
右击控件,“改变样式表...”,输入
QGroupBox{
border:1px solid gray;
border-radius:5px;//设置半径的大小;
margin-top:1ex;
border-color: rgb(0, 155, 232);
background-image:url(://debugger.ico);//这一步要先添加资源文件,并复制路径;
}
QGroupBox::title {
    subcontrol-origin: margin;
    subcontrol-position: top center; /* position at the top center */
    padding: 0 3px;
    background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
                                      stop: 0 #FF0ECE, stop: 1 #FFFFFF);
}
2.QLabel的样式表
QLabel{
border:1px solid gray;
border-radius:5px;//设置半径的大小;
margin-top:1ex;
border-color: rgb(0, 155, 232);
background-image:url(://XXX.ico);//这一步要先添加资源文件,并复制路径;
}

猜你喜欢

转载自blog.csdn.net/qq_18396171/article/details/79758969