Qt setStyleSheet

Qt中设置按钮或QWidget的外观是,可以使用QT Style Sheets来进行设置,非常方便。
可以用setStyleSheet("font: bold; font-size:20px; color: rgb(241, 70, 62); background-color: green");来进行设置,

其他的样式介绍如下:


font: bold; 是否粗体显示

font-family:""; 来设定字体所属家族,

font-size:20px; 来设定字体大小

font-style: nomal; 来设定字体样式

font-weight:20px; 来设定字体深浅

border: 1px solid gray;边框颜色
border-image:""; 用来设定边框的背景图片。
border-radius:5px; 用来设定边框的弧度。可以设定圆角的按钮
border-width: 1px; 边框大小

 background-color: green; 设置背景颜色
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.等分别来设定他们的颜色,样式和宽度

原文:https://blog.csdn.net/shado_walker/article/details/51425532

猜你喜欢

转载自www.cnblogs.com/nanqiang/p/10026678.html
QT
今日推荐