Qt中設置按鈕或QWidget的外觀是,可以使用QT Style Sheets來進行設置,非常方便。
可以用setStyleSheet("font: bold; font-size:20px; color: rgb(241, 70, 62); 來進行設置,其他的樣式介紹如下:
font: bold; 是否粗體顯示
border-image:""; 用來設定邊框的背景圖片。
border-radius:5px; 用來設定邊框的弧度。可以設定圓角的按鈕
border-width: 1px; 邊框大小
font-family:""; 來設定字體所屬家族,
font-size:20px; 來設定字體大小
font-style:""; 來設定字體樣式
font-weight:20px; 來設定字體深淺
設置背景顏色
background:transparent; 設置背景為透明
color:rgb(241, 70, 62); 設置前景顏色
selection-color:rgb(241, 70, 62); 用來設定選中時候的顏色
可以使用border-top,border-right,border-bottom,border-left分別設定按鈕的上下左右邊框,
同樣有border-left-color, border-left-style, border-left-width.等分別來設定他們的顏色,樣式和寬度