天天看點

QT的QSS樣式總結

QLineEdit{
	background-color:rgb(51,51,51);
    border-radius: 7px;
    border:1px;
	border-style:outset;# 有邊框
	boeder-color:Gray
}

background-color: rgba(255, 0, 0, 0.5);# 最後一位透明度

圓角窗體(有鋸齒)
QWidget{
	background-color:rgb(33,37,38);
	border-top-left-radius:15px;
	border-top-right-radius:15px;
	border-bottom-left-radius:15px; 
	border-bottom-right-radius:15px;
 }

button點選增加邊框
border: 1px solid #3C3C3C!important;
border: 1px solid #3C3C3C!important;

volumeSlider->setStyleSheet("  \
    QSlider\
    {\
        background-color: rgb(25, 38, 58);\
        min-width:5px;\
        max-width:5px;\
        border:15px solid rgb(25, 38, 58);\
    }\
     QSlider::add-page:vertical\
     {     \
        background-color: rgb(37, 168, 198);\
        width:4px;\
     }\
     QSlider::sub-page:vertical \
    {\
        background-color: rgb(87, 97, 106);\
        width:4px;\
     }\
    QSlider::groove:vertical \
    {\
        background:transparent;\
        width:6px;\
    }\
    QSlider::handle:vertical \
    {\
         height: 13px;\
        width:13px;\
        border-image: url(:/images/ic_volume_thumb.png);\
         margin: -0 -4px; \
     }\
    ");

QLabel 設定下劃線 text-decoration:underline;
    加背景圖檔
	background-image:url(E:\\Host\\images\\robot.png);
    設定圖檔位置
	background-position:center;
    圖檔重複嗎?
    background-repeat:no-repeat;


QComboBox {
    border: 1px solid gray;
    border-radius: 3px;
    padding: 1px 18px 1px 3px;
    min-width: 6em;
}
 
QComboBox:editable {
    background: white;
}
 
QComboBox:!editable, QComboBox::drop-down:editable {
     設定漸變色
     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);
}
 
/* QComboBox gets the "on" state when the popup is open */
QComboBox:!editable:on, QComboBox::drop-down:editable:on {
    background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
                                stop: 0 #D3D3D3, stop: 0.4 #D8D8D8,
                                stop: 0.5 #DDDDDD, stop: 1.0 #E1E1E1);
}
 
QComboBox:on { /* shift the text when the popup opens */
    padding-top: 3px;
    padding-left: 4px;
}
 
QComboBox::drop-down {
    subcontrol-origin: padding;
    subcontrol-position: top right;
    width: 15px;
 
    border-left-width: 1px;
    border-left-color: darkgray;
    border-left-style: solid; /* just a single line */
    border-top-right-radius: 3px; /* same radius as the QComboBox */
    border-bottom-right-radius: 3px;
}
 
QComboBox::down-arrow {
    image: url(/usr/share/icons/crystalsvg/16x16/actions/1downarrow.png);
}
 
QComboBox::down-arrow:on { /* shift the arrow when popup is open */
    top: 1px;
    left: 1px;
}

QComboBox{
	color:rgb(185,185,185);
	background-color:rgb(51,51,51);
	selection-background-color: rgb(51,51,51);
    border-radius: 7px;
    border:1px;
	padding-left:25px;
}
QComboBox::drop-down {
	subcontrol-origin: padding;
	subcontrol-position: top right;
	width: 30px;
	border-left-width: 0px;
	border-left-color: gray;
	border-left-style: solid;
	border-top-right-radius: 3px;
	border-bottom-right-radius: 3px;
}
QComboBox::down-arrow {
	image: url(E:/Host/images/ad.png);
	padding-right:5px;
}
           

繼續閱讀