Qt的窗口背景及窗口风格统一与焕肤

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

btn1->setStyleSheet("QPushButton{background:yellow}"); //设定背景颜色为红色

this->setStyleSheet("color:red; background-image:url(:/33.jpg)"); //字体颜色设置成红色(前景色),背景色设置成图片

this->setWindowIcon(QIcon(":/image/1.jpg")); //设置图标    如下图:

文本框、按钮等变成圆角(内容填充padding)

ui.comboDriver->setStyleSheet("border:2px groove pink;border-radius:10px;padding:2px 16px;");
ui.editDatabase->setStyleSheet("border:2px groove gray;border-radius:10px;padding:2px 16px;");
ui.editPassword->setStyleSheet("border:2px groove blue;border-radius:10px;padding:2px 16px;");
ui.editHostname->setStyleSheet("border:2px groove yellow;border-radius:10px;padding:2px 16px;");
ui.editUsername->setStyleSheet("border:2px groove green;border-radius:10px;padding:2px 16px;");
ui.portSpinBox->setStyleSheet("border:2px groove blue;border-radius:10px;padding:2px 16px;");
效果如下图:

pushButton->setStyleSheet("border:2px groove gray;border-radius:10px;padding:2px 4px;");  //按钮圆角

												

QT5 样式随笔的更多相关文章

  1. qt creator源码全方面分析(2-1)

    目录 coding-style.html 提交代码 二进制兼容性和源代码兼容性 代码构造 格式化 利用标识符 空格 大括号 圆括号 换行符 声明 命名空间 模式与实践 命名空间 传递文件名 插件扩展点 ...

  2. css小随笔(二)与通用样式

    51先在学校HTML5已经有半个多月了,然后这个星期做了一个京东的手机网站,接触到了通用样式,下面以京东的手机站为例 这两个就是京东手机站了的不同的两个板块,因为HTML5仅仅只是学完了基本标签跟cs ...

  3. android 学习随笔十九(对话框、样式、主题、国际化 )

    1.对话框 package com.itheima.dialog; import android.os.Bundle; import android.app.Activity; import andr ...

  4. CSS随笔1(CSS常用样式)

    样式 属性 大小 font-size(x-large ; xx-small ; 可用数值单位 : PX,PD) 样式 font-style(oblique 偏斜体 : italic 斜体 : norm ...

  5. SSRS报表服务随笔(rdl报表服务)-报表结构与样式

    设计rdl报表,比设置HTML页面简单多了,Reporting报表分为页眉,页脚,主体三个部分 rdl文件实际是xml结构的文件,具体是什么语言呢,很抱歉,这点我还不能回复,在我看来,是由固定节点的x ...

  6. Vue.js随笔二(新建路由+component+添加样式+变量的显示)

    创建一个页面: 1.首先让我们看一下整个vue.js的目录,如下图所示: 2.现在让我们创建一个页面吧: 2-1首先你需要新建路由(就和建立一个如何找到项目文件的目录一个意思):进入src/route ...

  7. PyQt(Python+Qt)学习随笔:Qt Designer中部件的样式表styleSheet属性

    styleSheet属性是定义部件外观的属性样式表,在Qt中styleSheet样式表是类似于html的css样式一样的方法,只是时专门为Qt中的部件开发的.styleSheet的定义语法也是类似CS ...

  8. PyQt(Python+Qt)学习随笔:Designer(设计师)中部件属性编辑的cursor(光标样式)属性

    部件(又称为组件或控件)的cursor属性保存该部件的鼠标光标形状,当鼠标位于该部件上时就会呈现该属性设置的光标形状,对应类型为枚举类型Qt.CursorShape,可取值的范围可以在Qt文档官网:h ...

  9. js随笔,css和js禁止网页选择文本,table的class样式使得td的class样式失效,jquery获得元素坐标

    css使用user-select,user-select不是W3C标准,浏览器支持不完整:user-select有两个值,none用户不可以选择文本,text用户可以选择文本 body{-moz-us ...

随机推荐

  1. 解决 Previous operation has not finihsed; run ‘cleanup’ if it was interrupted Please execute the ‘Cleanup’ command

    更新时遇到这个问题,解决方法如下: 把根目录下的.svn目录删除掉,再checkout,然后就会出现下面的加version的action.   疯吻IT

  2. Python 进程间的通信

    #-*-coding:utf-8-*- '''python提供了多种进程间的通信方式,如:Queue,Pipe,Valie+Array等. Queue与Pipe的区别在于Pipe常用来在两个进程间通信 ...

  3. c++并发编程之原子操作的实现原理

    原子(atomic)本意是”不能被进一步分割的最小粒子”,而原子操作(atomic operation)意为”不可被中断的一个或一系列操作”. 处理器如何实现原子操作 (1) 使用总线锁保证原子性 如 ...

  4. vmware:Could not open /dev/vmmon: No such file or directory.

    Q: Could not open /dev/vmmon: No such file or directory. Please make sure that the kernel module `vm ...

  5. First non-repeating character in a stream

    First non-repeating character in a stream Given an input stream of n characters consisting only of s ...

  6. Python内置的操作系统模块(os)与解释器交互模块(sys)

    Python内置的操作系统模块(os)与解释器交互模块(sys) 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 本片博客只介绍Python调用操作系统的模块即os模块,以及Pyth ...

  7. ASP.NET MVC学习(五)之MVC原理解析

    ASP.NET MVC 请求生命周期 生命周期步骤概览 当我们对ASP.NET MVC网站发出一个请求的时候,会发生5个主要步骤: 步骤1:创建RouteTable 当ASP.NET应用程序第一次启动 ...

  8. the error about “no such file or directory”

    CHENYILONG Blog the error about "no such file or directory" when you get the question like ...

  9. Python基础教程-第3版(文字版) 超清文字-非扫描版 [免积分、免登录]

    此处免费下载,无需账号,无需登录,无需积分.收集自互联网,侵权通知删除. 点击下载:Python基础教程-第3版 备用下载:Python基础教程-第3版

  10. mysql grep database error(cannot rmdir /dbname)

    service mysql stop cd /var/lib/mysql/dbname rm -rf .fmr rm -rf .txt service mysql start srop databas ...