为QT添加qss样式文件
生活随笔
收集整理的這篇文章主要介紹了
为QT添加qss样式文件
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
代碼
QFile file("my.qss"); file.open(QFile::ReadOnly); QString styleSh = tr(file.readAll()); setStyleSheet(styleSh);my.qss文件內(nèi)容
/* 正常時(shí),按鈕顏色 */ QPushButton{background-color:rgb(240,255,255);color: rgb(0, 0, 2);border-style: outset;border-color: beige;border-radius: 10px; } /* 鼠標(biāo)在按鈕上時(shí),按鈕顏色 */QPushButton:hover {background-color:rgb(14, 220, 0);border-radius: 10px;color: rgb(0, 0, 0); }/* 按鈕被單擊后,按鈕顏色 */ QPushButton:checked {background-color:rgb(14, 170, 79);border-radius: 10px;color: rgb(255, 255, 0); }總結(jié)
以上是生活随笔為你收集整理的为QT添加qss样式文件的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 判断101-200之间有多少个素数,并输
- 下一篇: C++学习之路(一)