Qt Style Sheets Examples——定制前景色和背景色
例子取自:http://qt-project.org/doc/qt-4.8/stylesheet-examples.html
以lineEdit为例
(1)设置某个lineEdit的背景色为黄色
lineEdit->setStyleSheet ("background-color:yellow");
(2)设置一个应用项目中所有lineEdit的背景色均为黄色(line 4)
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.setStyleSheet ("QLineEdit {background-color:yellow}");
Widget w;
w.show();
return a.exec();
}
(3)设置某一个对话框中的所有lineEdit的背景色均为黄色
myDialog->setStyleSheet("QLineEdit { background-color: yellow }");
(4)设置lineEdit的文本颜色为红色
lineEdit->setStyleSheet ("color:red");
(5)综合实例
lineEdit->setStyleSheet ("background-color:yellow;"
"color:red;"
"selection-color:blur;"
"selection-backgroundcolor:green;");
注意!如果既要设置文本颜色为红色,又要设置背景色为黄色,不能这样写:
lineEdit->setStyleSheet ("background-color:yellow");
lineEdit->setStyleSheet ("color:red");
两个效果不是叠加的,后者会覆盖前者,就是说,文本颜色被设置为红色而背景色并不是黄色。要同时实现两种效果应该如上一个例子那样编写程序。
2013-09-02 17:24:21
Qt Style Sheets Examples——定制前景色和背景色的更多相关文章
- Qt Style Sheets Examples(官方例子目录,很全)
Contents Style Sheet Usage Customizing the Foreground and Background Colors Customizing Using Dynami ...
- Qt Style Sheets Examples(QT真是有很全的文档)
http://doc.qt.io/qt-5/stylesheet-examples.html http://doc.qt.io/qt-4.8/stylesheet.html
- Qt Style Sheets帮助文档 Overview
Qt Style Sheets are a powerful mechanism that allows you to customize the appearance of widgets, in ...
- Qt Style Sheets制作UI特效
使用Qt Style Sheets制作UI特效 博客出处:http://developer.nokia.com/community/wiki/%E4%BD%BF%E7%94%A8Qt_Style_S ...
- 使用Qt Style Sheets制作UI特效
引言 作为一套GUI框架,Qt是非常强大的.(注:Qt 不仅是一套优秀的GUI框架,同时也是一套出色的应用程序框架).在UI的制作方面Qt为广大开发者提供了一套强大而易用的工具,她就是——Qt Sty ...
- Qt Style Sheets Reference
Qt Style Sheets support various properties, pseudo-states, and subcontrols that make it possible to ...
- Qt4.7文档翻译:Qt样式单参考,Qt Style Sheets Reference(超长,超全)
内容目录 Qt样式单参考 可进行样式设置的部件列表 属性列表 图标列表 属性类型列表 伪状态列表 子控件列表 Qt样式单参考 Qt样式单支持各种属性.伪状态和子控件,这样使得妳能够自行设计部件的外观. ...
- Qt 外观之一 ——Qt Style Sheet
Qt Style Sheet 目录 使用 对于应用程序 创建自定义控件 QSS语法 一般选择器(selector) 伪选择器 解决冲突 使用specificity Namespace冲突 级联效应 设 ...
- matplotlib 可视化 —— 定制画布风格 Customizing plots with style sheets(plt.style)
Customizing plots with style sheets - Matplotlib 1.5.1 documentation 1. 使用和显示其他画布风格 >> import ...
随机推荐
- windows下安装PhpDocumentor(phpdoc)笔记
PhpDocumentor简介 PHPDocumentor是一个用PHP写的工具,对于有规范注释的php程序,它能够快速生成具有相互参照,索引等功能的API文档.老的版本是phpdoc,从1.3.0开 ...
- crossplatform---Node.js Applications with VS Code
Node.js is a platform for building fast and scalable server applications using JavaScript. Node.js i ...
- paip.执行shell cmd 命令uapi java php python总结
paip.执行shell cmd 命令uapi java php python总结 作者Attilax 艾龙, EMAIL:1466519819@qq.com 来源:attilax的专栏 地址:h ...
- 文件上传小技巧/后端处理【以php示例】
引语:在上一篇文章中说到,在页面中可以用隐藏的方式让你的上传页面看起来漂亮.但是这对于性能来说,并没有什么卵用,那么在后台的处理中,难道就没有一些处理技巧么?所谓后台的技巧,应该要包括上传得快一点,上 ...
- 安装Ubuntu14.04版本的操作系统
1:安装好虚拟机之后便是安装操作系统,操作系统分为好多种,在这里笔者使用的是Ubuntu14.04版本的操作系统,除此之后还可以使用fedora或者小红帽等等操作系统 软件包http://pan.ba ...
- [ZT]Language codes – MFC
Below is table with all MFC language codes. I think it can be sometimes very useful. First column c ...
- 单元测试 mock EF 中DbContext 和DbSet Include
现在EF越来越流行了,很多时候业务成都是直接访问DbContext 和DbSet来操作数据的. 那么我们测试的时候如何来mock这2个对象了?现在时间很晚了, 就直接贴code吧 首先看看的我们DbC ...
- IOS 7 UI 的适配
官方问题答案:https://developer.apple.com/library/ios/qa/qa1797/_index.html 官方建议: https://developer.apple.c ...
- Activemq消息类型
Activemq消息类型JMS规范中的消息类型包括TextMessage.MapMessage.ObjectMessage.BytesMessage.和StreamMessage等五种.ActiveM ...
- 外包采用Gradle生成多套app打包
目的:可修改app名称.icon.包名.接口地址及其它 一. 修改基本配置(包名.版本号等) 配置module下的build.gradle 添加productFlavors例如: produ ...