QPushBitton
QPushButton{ min-width:75px; max-width:75px; min-height:20px; border:1px solid black; // 邊框 border-radius:5px; //圓角 } QPushButton:pressed{ background-color: #111111; border-color: #333333; color: yellow; }
樣式:
圓形QLabel
QLabel{ min-width:60px; max-width:60px; min-height:60px; max-height:60px; border-radius:30px; //圓角 border:1px solid black; //邊框線 }
樣式:
也可以使用setStyleSheet()函數來設計樣式:
例如:
ui->time_label->setStyleSheet("QLabel{font: 15pt 宋體;color:rgb(255, 255, 255);background-color: #222648;" "min-width:180px;max-width:180px;min-height:180px;max-height:180px;border:1px solid white;border-radius:90px}");
其它控件樣式表:
指定QLabel中的label_1
QLabel#label_3{ color:rgb(0,193,231); } QLabel#label_2{ color:white; } QLabel#label_1{ color:white; }
QTableWidget
QTableWidget{ outline:0px; font: 14px "Microsoft YaHei"; border:1px solid #1B5FA1; background-color:rgba(255, 255, 255, 0%); gridline-color:#1B5FA1; color: #FFFFFF; border-top:0px solid #EEF1F7; alternate-background-color:rgba(6, 69, 127, 0.29); } QHeaderView::section{ text-align:center; color: #AFE4FF; background-color: rgba(5, 81, 139, 0.63); font: 16px "Microsoft YaHei"; padding:3px; margin:0px; border:0px solid #242424; border-top-width:0; border-right-width:0; } QTableWidget::item:selected{ background:rgba(0,8,50,0); }
QLineEdit
QLineEdit{ border:1px solid rgb(28,74,121); background-color: rgba(255, 255, 255, 0%); //添加背景色,第四個參數為透明度范圍(0,1) color:white; }
QRadioButton
QRadioButton{ color:#19e085; font:14px 'Microsoft YaHei'; } QRadioButton::indicator{ //QRadioButton的方框 background-color:#19e085; width:10px; height:10px; border-radius:5px; }