今天查了一些文檔,準備本身一步一步地使用Qss來模仿一下windows的Metro風格, 我不會CSS也不會Qss全是查文檔而來的,因此有點粗糙,今天是QPushbutton的Qss代碼: css
QPushButton { color: rgb(255, 255, 255); background-color: rgb(167, 205, 255); border:none; padding: 3px; font-family: "Verdana"; font-size: 15px; text-align: center; } QPushButton:hover, QPushButton:pressed , QPushButton:checked { background-color: rgb(85, 170, 255); text-align: right; padding-right: 20px; font-weight:100 } QPushButton:hover { background-image: url(:/icon/icons/dark/appbar.navigate.next.png); background-repeat:no-repeat; background-position: center left; } QPushButton:pressed, QPushButton:checked { background-image: url(:/icon/icons/light/appbar.navigate.next.png); background-repeat:no-repeat; background-position: center left; }
其中用到了兩張資源圖片(http://modernuiicons.com/ 下載的Metro圖標)做爲美化,在hovering到按鈕上面的時候和按下的時候用不一樣的顏色。 windows
下面是效果圖。 app