#ifndef QSS_H
#define QSS_H
#include <QMainWindow>
//如果只有x相等,则表示垂直线性渐变,
//如果只有y相等,则表示平行线性渐变,
//如果只有xy相等,则就是斜角线性渐变
//cx:0.5, cy:0.5, radius:0.5 angle 0
//cx cy 是原点位置 radius半径 angle:旋转角度
inline QString Button_QSS_1(){
//上下渐变
return "QPushButton"
" {"
" background-color: qlineargradient(spread:pad, x1:0, x2:0, y1:0, y2:1,stop: 0 rgba(160,160,160,255),"
" stop: 0.495 rgba(180,180,180,255),stop: 0.505 rgba(210,210,210,255),stop: 1 rgba(230,230,230,255));"
" background-position:center center;"
" font-family:楷体;"
" color: black;border-radius:2px;border:2px groove gray;border-style: outset;"
" }"
" QPushButton:pressed{"
" background-color:rgb(85, 170, 255);"
" border-style: inset;"
" }";
}
inline QString Button_QSS_2(){
//左右渐变
return "QPushButton"
" {"
" font-family:20px 楷体;"
" font-weight: bold;"
" color: rgba(250, 250, 250, 255);"
" background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgb(180, 200, 255), stop:1 rgb(180, 170, 255));"
" color: black;border-radius:2px;border:2px groove gray;border-style: outset;"
" }"
" QPushButton:pressed{"
" background-color:rgb(85, 170, 255);"
" border-style: inset;"
" }";
}
inline QString Button_QSS_3(){
//上下左右渐变
return "QPushButton"
" {"
" font-family:16px 楷体;"
" font-weight: bold;"
" background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, "
"stop:0 rgb(160, 200, 255),"
"stop:0.2 rgb(170, 170, 255),"
"stop:0.5 rgb(180, 200, 255),"
"stop:0.8 rgb(190, 170, 255),"
"stop:1 rgb(200, 170, 255));"
" color: black;border-radius:2px;border:2px groove gray;border-style: outset;"
" }"
" QPushButton:pressed{"
" background-color:rgb(85, 170, 255);"
" border-style: inset;"
" }";
}
inline QString Button_QSS_4(){
//辐射渐变
return "QPushButton"
" {"
" font-family:20px 楷体;"
" font-weight: bold;"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,"
" stop:0 rgba(255, 100, 0, 255),"
" stop:0.19397 rgba(205, 200, 0, 255),"
" stop:0.202312 rgba(122, 97, 0, 255),"
" stop:0.495514 rgba(76, 58, 0, 255),"
" stop:0.504819 rgba(255, 255, 255, 255),"
" stop:0.79 rgba(255, 255, 255, 255),"
" stop:1 rgba(255, 158, 158, 255));"
" color: black;border-radius:2px;border:2px groove gray;border-style: outset;"
" }"
" QPushButton:pressed{"
" background-color:rgb(85, 170, 255);"
" border-style: inset;"
" }";
}
inline QString Button_QSS_5(){
//辐射渐变
return "QPushButton"
" {"
" font-family:20px 楷体;"
" font-weight: bold;"
" background-color: qconicalgradient(cx:0.5, cy:0.5, angle:0,"
" stop:0 rgba(255, 255, 255, 255), stop:0.373979 rgba(255, 255, 255, 255),"
" stop:0.373991 rgba(33, 30, 255, 255), stop:0.624018 rgba(33, 30, 255, 255),"
" stop:0.624043 rgba(255, 0, 0, 255), stop:1 rgba(255, 0, 0, 255));"
" }"
" QPushButton:pressed{"
" background-color:rgb(85, 170, 255);"
" border-style: inset;"
" }";
}
inline QString Button_QSS_6(){
//辐射渐变
return "QPushButton"
" {"
" font-family:20px 楷体;"
" font-weight: bold;"
" background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0,"
" stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));"
" }"
" QPushButton:pressed{"
" background-color:rgb(85, 170, 255);"
" border-style: inset;"
" }";
}
inline QString Button_QSS_7(){
//辐射渐变
return "QPushButton"
" {"
" font-family:20px 楷体;"
" font-weight: bold;"
" background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, "
"stop:0 rgba(255, 0, 0, 255), stop:0.339795 rgba(255, 0, 0, 255), "
"stop:0.339799 rgba(255, 255, 255, 255), stop:0.662444 rgba(255, 255, 255, 255), "
"stop:0.662469 rgba(0, 0, 255, 255), stop:1 rgba(0, 0, 255, 255));"
" }"
" QPushButton:pressed{"
" background-color:rgb(85, 170, 255);"
" border-style: inset;"
" }";
}
inline QString Button_QSS_8(){
//辐射渐变
return "QPushButton"
" {"
" font-family:20px 楷体;"
" font-weight: bold;"
" background-color:qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, "
" stop:0 rgba(255, 255, 255, 255), stop:0.1 rgba(255, 255, 255, 255), "
" stop:0.2 rgba(255, 176, 176, 167), stop:0.3 rgba(255, 151, 151, 92), "
" stop:0.4 rgba(255, 125, 125, 51), stop:0.5 rgba(255, 76, 76, 205), "
" stop:0.52 rgba(255, 76, 76, 205), stop:0.6 rgba(255, 180, 180, 84), "
" stop:1 rgba(255, 255, 255, 0));"
" }"
" QPushButton:pressed{"
" background-color:rgb(85, 170, 255);"
" border-style: inset;"
" }";
}
inline QString Button_QSS_9(){
//辐射渐变
return "QPushButton"
" {"
" font-family:20px 楷体;"
" font-weight: bold;"
" background-color:qconicalgradient(cx:0.5, cy:0.5, angle:0, stop:0 rgba(35, 40, 3, 255),"
" stop:0.16 rgba(136, 106, 22, 255), stop:0.225 rgba(166, 140, 41, 255), stop:0.285 rgba(204, 181, 74, 255),"
" stop:0.345 rgba(235, 219, 102, 255), stop:0.415 rgba(245, 236, 112, 255), stop:0.52 rgba(209, 190, 76, 255),"
" stop:0.57 rgba(187, 156, 51, 255), stop:0.635 rgba(168, 142, 42, 255), stop:0.695 rgba(202, 174, 68, 255),"
" stop:0.75 rgba(218, 202, 86, 255), stop:0.815 rgba(208, 187, 73, 255), stop:0.88 rgba(187, 156, 51, 255),"
" stop:0.935 rgba(137, 108, 26, 255), stop:1 rgba(35, 40, 3, 255));"
" }"
" QPushButton:pressed{"
" background-color:rgb(85, 170, 255);"
" border-style: inset;"
" }";
}
inline QString Button_QSS_10(){
//辐射渐变
return "QPushButton"
" {"
" font-family:20px 楷体;"
" font-weight: bold;"
" background-color:qconicalgradient(cx:0, cy:0, angle:135, stop:0 rgba(255, 255, 0, 69),"
" stop:0.375 rgba(255, 255, 0, 69), stop:0.423533 rgba(251, 255, 0, 145), stop:0.45 rgba(247, 255, 0, 208),"
" stop:0.477581 rgba(255, 244, 71, 130), stop:0.518717 rgba(255, 218, 71, 130), stop:0.55 rgba(255, 255, 0, 255),"
" stop:0.57754 rgba(255, 203, 0, 130), stop:0.625 rgba(255, 255, 0, 69), stop:1 rgba(255, 255, 0, 69));"
" }"
" QPushButton:pressed{"
" background-color:rgb(85, 170, 255);"
" border-style: inset;"
" }";
}
/***********************************************************************************************************************************************/
inline QString MenuBar_QSS_1(){
//注:在顶部时需设置宽度,在左侧时需设置高度,否则手柄不可见
//1、工具栏位于顶部或左侧时的背景色为红色
//2、工具栏位于行分组的中间位置时的背景色为绿色
//3、工具栏位于顶部或左侧时,其手柄背景色为紫色,宽度和高度各为22像素
//4、工具栏分隔符的背景色为黄色,在水平方向时宽度为11,在垂直方向时高度为11
//5、以下为对菜单和菜单栏的设置(较简单)
return "QMenuBar"
"{"
"background-color:rgb(111,111,1);spacing:10;"
"font: 14px 楷体"
"}" //"QMenuBar::item{background-color:white;}"
;
}
inline QString Combox_QSS(){
return "QComboBox"
" {"
" border: 1px solid gray; " /* 边框 */
" border-radius: 3px; " /* 圆角 */
" padding: 1px 18px 1px 3px; " /* 字体填衬 */
" color: #000; "
" font: normal normal 15px Microsoft YaHei;"
" background: transparent;"
" }"
/* 下拉后,整个下拉窗体样式 */
" QComboBox QAbstractItemView {"
" outline: 0px solid gray;" /* 选定项的虚框 */
" border: 1px solid yellow;" /* 整个下拉窗体的边框 */
" color: green;"
" background-color:rgb(85, 170, 255);" /* 整个下拉窗体的背景色 */
" selection-background-color: lightgreen;" /* 整个下拉窗体被选中项的背景色 */
" }"
/* 下拉后,整个下拉窗体每项的样式 */
" QComboBox QAbstractItemView::item {"
" height: 50px;" /* 项的高度(设置pComboBox->setView(new QListView());后,该项才起作用) */
" }"
/* 下拉后,整个下拉窗体越过每项的样式 */
" QComboBox QAbstractItemView::item:hover {"
" color: #FFFFFF;"
" background-color: lightgreen;" /* 整个下拉窗体越过每项的背景色 */
" }"
/* 下拉后,整个下拉窗体被选择的每项的样式 */
" QComboBox QAbstractItemView::item:selected {"
" color: #FFFFFF;"
" background-color: lightgreen;"
" }"
/* QComboBox中的垂直滚动条 */
" QComboBox QAbstractScrollArea QScrollBar:vertical {"
" width: 10px;"
" background-color: #d0d2d4; " /* 空白区域的背景色*/
" }"
;
}
inline QString LineEdit_QSS_1(){
return "QLineEdit"
"{"
" border: 1px solid #32435E;"
" border-radius: 5px;" /*控件边框的弧度,数值越大,则弯曲得越厉害*/
" background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1," /*背景*/
" stop: 0 #113845,"
" stop: 1.0 #15A8FF);"
" selection-background-color: #0A246A;"
" font: normal normal 15px Microsoft YaHei;"
" }"
" QLineEdit::hover{"
" border-color:#5D8B9E; " /*外边框的颜色*/
" }";
}
inline QString LineEdit_QSS_2(){
return "QLineEdit"
"{"
"border:1px rgb(124,124,124);"
"background-color: rgba(124,124,124, 0%);"
"border-radius:3px;"
"padding:1px 2px;"
"border-style: solid;"
"font-size : 15px ;"
"color: #000000;"
"}";
}
inline QString GroupBox_QSS_1(){
return "QGroupBox"
"{"
"border: 1px solid rgb(80,80,80);"
"border-radius:3px;"
"margin-top:1px;" //可以设置title放下沉
"}";
}
inline QString CheckBox_QSS_1(){
return "QCheckBox"
"{"
"font:20px;"
"color: rgb(0, 205, 205); "
"spacing: 8px;"
"width: 20px;"
"height: 20px;"
"}";
}
inline QString TabWidget_1(){
return "QTabWidget"
" QTabWidget::pane {" /* The tab widget frame */
"border-top: 2px solid #C2C7CB;"
"position: absolute;"
"top: -0.5em;"
"}"
"QTabWidget::tab-bar {"
"alignment: center;"
"}"
/* Style the tab using the tab sub-control. Note that
it reads QTabBar _not_ QTabWidget */
" QTabBar::tab {"
"background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
"stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,"
"stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);"
" border: 2px solid #C4C4C3;"
" border-bottom-color: #C2C7CB;" /* same as the pane color */
" border-top-left-radius: 4px;"
" border-top-right-radius: 4px;"
" min-width: 8ex;"
" padding: 2px;"
"}"
"QTabBar::tab:selected, QTabBar::tab:hover {"
"background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
"stop: 0 #fafafa, stop: 0.4 #f4f4f4,"
"stop: 0.5 #e7e7e7, stop: 1.0 #fafafa);"
"}"
"QTabBar::tab:selected {"
"border-color: #9B9B9B;"
"border-bottom-color: #C2C7CB;" /* same as pane color */
"}";
}
inline QString TabWidget_2(){
return "QTabWidget"
"QTabBar::tab{"
"font-family:楷体;" //#设置字体
"width:84px;" //#设置宽度
"height:30; " //#设置高度
"margin-top:5px; " //#设置边距
"margin-right:1px;"
"margin-left:1px;"
"margin-bottom:0px;"
"}"
"QTabWidget::tab-bar{"
"alignment: left;"
"}"
"QTabBar::tab:hover{"
"background:rgb(105, 205, 105, 100);"
"}"
"QTabWidget::pane{"
" border:none;"
"}"
;
}
static QString Check = "QRadioButton::indicator{width:20px;height:20px;border-radius:10px;}"
"QRadioButton::indicator:unchecked {image:url(:/resource/ledoff.ico);}"
"QRadioButton::indicator:checked {image:url(:/resource/ledon.ico);}";
#endif // QSS_H
自己使用的一套 QSS皮肤【不断更新】
最新推荐文章于 2024-04-19 09:39:56 发布