zoukankan      html  css  js  c++  java
  • 关于QT setStyleSheet的一些格式说明

    下面的内容都是我从网上自己总结的:

    1  btn1=new QPushButton(this);
       btn1->setStyleSheet("QPushButton{color:red;background:yellow}"); //设定前景颜色,就是字体颜色
       // btn1->setStyleSheet("QPushButton{background:yellow}");

    2  btn2=new QPushButton(this);
    btn2->setStyleSheet("QPushButton{color:red;background-color:rgb(200,155,100)}");//使用rgb来设定背景颜色
     
    3  btn3=new QPushButton(this);
       btn3->setStyleSheet("QPushButton{background-image:url(image/1.png);background-repeat: repeat-xy;background-position: center;
       background-attachment: fixed;background-clip: padding}");
      
       btn4=new QPushButton(this);
       btn4->setStyleSheet("QPushButton{border: 3px solid red;border-radius:8px}"); //设定边框宽度以及颜色

    其中:
      
    //border-image用来设定边框的背景图片。
    //background-repeat可以设定背景图片的重复规则,这里设定仅在xy方向都重复,所以图片会被重复一次
    //background-position用来设定图片的位置,是左(left)还是右(right),还是在中间(center),是上(top)还是底部(bottom)
    //background-attachment用来这定背景图片是否卷动或者和窗口大小相匹配,默认是卷动的
    //border-radius用来设定边框的弧度。可以设定圆角的按钮
     下面是效果图:

     
    
    
    
    
     
     
  • 相关阅读:
    CSS3学习-用CSS制作立体导航栏
    JS学习-事件响应小结-简单的计算器
    BOM学习-javascript计时器小结
    php 正则表达式
    zTree插件的应用
    css样式篇
    iso移动端input的bug解决(vue)
    html2canvas文字重叠(手机端)
    react中使用antd遇到的问题
    react开发初始配置和一些问题
  • 原文地址:https://www.cnblogs.com/tiantiantian-dianzi/p/5822529.html
Copyright © 2011-2022 走看看