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用来设定边框的弧度。可以设定圆角的按钮
     下面是效果图:

     
    
    
    
    
     
     
  • 相关阅读:
    iOS开发之字符串去掉首尾空格换行
    iOS开发之截取UIScrollView长图方法、截长图
    iOS开发之语音录制
    iOS开发之程序各种状态监听
    iOS开发之监听应用进入前台后台
    iOS开发之波浪动画效果
    mysql 主从一致性检查
    git 备份和恢复
    tomcat server.xml配置文件 解析
    检查MySQL主从数据一致性
  • 原文地址:https://www.cnblogs.com/tiantiantian-dianzi/p/5822529.html
Copyright © 2011-2022 走看看