QPushbutton設置按鈕文字位置(文本對齊方式)和左右上邊框線型和顏色

1.1 QPushbutton中,設置按鈕內容text可用QSS設置,QSS代碼爲:

text-align:bottom;

結合設置按鈕大小和背景圖標大小,可以設置上面圖標下面文字,中間間距可以任意調整效果。

 

1.2設置按鈕上面、左邊、右邊邊框線型和顏色

"#QCustomButton,QLabel{background:transparent;border:0px;color:white;}"
"#QCustomButton:hover{background:rgba(17,24,47,0.8);border:0px;border-left:1px solid rgba(82,130,164,1); border-right:1px solid rgba(82,130,164,1);border-top:1px solid rgba(82,130,164,1);}"
"#QCustomButton:checked{background:rgba(17,24,47,1);border:0px;border-left:1px solid rgba(82,130,164,1); border-right:1px solid rgba(82,130,164,1);border-top:1px solid rgba(82,130,164,1);}"

 

 

 

參考內容:

https://www.w3school.com.cn/cssref/pr_text_text-align.asp(參考:CSS設置文本位置)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章