Qt中设置按钮或QWidget的外观是,可以使用QT Style Sheets来进行设置,非常方便。
   
可以用setStyleSheet(“font: bold; font-size:20px; color: rgb(241, 70, 62); background-color: green”);来进行设置,其他的样式介绍如下:
   
font: bold;
   
   
是否粗体显示
   
border-image:””;
   
   
用来设定边框的背景图片。
   
border-radius:5px;
   
   
用来设定边框的弧度。可以设定圆角的按钮
   
border-width: 1px;
   
   
边框大小
可以用setStyleSheet(“font: bold; font-size:20px; color: rgb(241, 70, 62); background-color: green”);来进行设置,其他的样式介绍如下:
font: bold;
是否粗体显示
border-image:””;
用来设定边框的背景图片。
border-radius:5px;
用来设定边框的弧度。可以设定圆角的按钮
border-width: 1px;
边框大小
   font-family:””;
   
   
   来设定字体所属家族,
   
   font-size:20px;
   
   
   来设定字体大小
   
   font-style:””;
   
   
   来设定字体样式
   
   font-weight:20px;
   
   
   来设定字体深浅
   
   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.等分别来设定他们的颜色,样式和宽度
  
 
版权声明:本文为Shado_walker原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
