Qt中Spinbox,DateTimeEdit等控制元件樣式表:箭頭在左右兩邊QSS程式碼示例

52_赫茲的鯨發表於2018-09-27

圖示:
在這裡插入圖片描述

/*spinbox 抬起樣式*/
QDateTimeEdit::up-button,QTimeEdit::up-button,QDoubleSpinBox::up-button,QSpinBox::up-button {subcontrol-origin:border;
	subcontrol-position:right;
	image: url(:/image/add.png);
	width: 60px;
	height: 60px;				
}
QDateTimeEdit::down-button,QTimeEdit::down-button,QDoubleSpinBox::down-button,QSpinBox::down-button {subcontrol-origin:border;
	subcontrol-position:left;
	image: url(:/image/reduce.png);
	width: 60px;
	height: 60px;
}
/*按鈕按下樣式*/
QDateTimeEdit::up-button:pressed,QTimeEdit::up-button:pressed,QDoubleSpinBox::up-button:pressed,QSpinBox::up-button:pressed{subcontrol-origin:border;
	subcontrol-position:right;
	image: url(:/image/add_click.png);
	width: 60px;
	height: 60px;		
}
 
QDateTimeEdit::down-button:pressed,QTimeEdit::down-button:pressed,QDoubleSpinBox::down-button:pressed,QSpinBox::down-button:pressed{
	subcontrol-position:left;
	image: url(:/image/reduce_click.png);
	width: 60px;
	height: 60px;}
}

相關文章