还是Qt 通过stylesheet或者palette设置背景色的问题
关于Qt,设置一个widget的背景色后,希望子对象不受影响。 很久以前在QtForum上问过一个问题:http://www.qtforum.org/post/94103/setting-background-color-on-widgets-makes-child-widget-wrong-style.html?highlight=#post94103
在stackoverflow上也有类似的问题:http://stackoverflow.com/questions/177778/in-qt-how-do-i-set-the-background-color-of-a-widget-like-combobox-or-double-spin
现在的方法是:
1. 要是设置整个对话框的,就用palette
2. 要是设置某个对象的,就用selector
| Class Selector | .QPushButton | Matches instances of QPushButton , but not of its subclasses.
This is equivalent to *[class~="QPushButton"] . |
或者
| ID Selector | QPushButton#okButton | Matches all QPushButton instances whose object name is okButton . |
http://blog.csdn.net/aladdina/article/details/4800079
还是Qt 通过stylesheet或者palette设置背景色的问题的更多相关文章
- Qt子类化后qss设置背景色无效的问题
1.问题背景 在某个类中,用到了一个组合的widget,有按钮进度条等,类似于视频播放器按钮控制区和精度条(参考了很多feiyangqingyun的文章,感谢),调试正常后整理代码,为了提高代码可读性 ...
- Qt QGroupBox StyleSheet 边框设置
/**************************************************************************** * Qt QGroupBox StyleSh ...
- Qt修改图片的背景色及设置背景色为透明的方法
先上干货. Qt下修改图片背景色的方法: 方法一: QPixmap CKnitWidget::ChangeImageColor(QPixmap sourcePixmap, QColor origCol ...
- Qt子窗口设置背景色只能应用到其中的部件的问题
问题描述:设置父窗口后子窗口会嵌在父窗口中,背景变透明,此时用qss设置子窗口的背景色发现只应用到的子窗口的控件中,除控件外的地方并没有应用到背景色. 解决方法:不使用qss设置背景色,重写paint ...
- QLCDNumber设置背景色和显示数字颜色
只看楼主 倒序阅读楼主 发表于: 2013-10-22 //LCD时间显示 QLCDNumber *m_pLcdTime = new QLCDNumber(thi ...
- 关于Qt的StyleSheet作用范围
Qt的StyleSheet是很方便的一个设置各种控件风格形态的属性,但是默认的StyleSheet会作用于所有的子控件,容易带来麻烦,以下几种情况,可以限制作用范围 以QTextEdit为例,实体名为 ...
- QLCDNumber设置背景色和显示数字颜色【转载】
http://www.qtcn.org/bbs/read-htm-tid-55176.html //LCD时间显示 QLCDNumber *m_pLcdTime = new QLCDNumber ...
- listview当选中某一个item时设置背景色其他的不变
listview当选中某一个item时设置背景色其他的不变: 可以使用listview.setOnFoucsChangeListener(listener) ; /** * listview获得焦点和 ...
- java 解决JFrame不能设置背景色的问题 分类: Java Game 2014-08-15 09:48 119人阅读 评论(0) 收藏
这段时间比较多,于是写一写JAVA的一些IT技术文章.如有JAVA高手请加QQ:314783246,互相讨论. 在Java的GUI设计中,Frame和JFrame两者之间有很大差别,上次刚学时编一个窗 ...
随机推荐
- Dcloud课程4 如何进行APP接口开发
Dcloud课程4 如何进行APP接口开发 一.总结 一句话总结:通过json或者xml. 1.APP如何进行通信? 通过在地址上接参数指明传递的数据的类型.而数据传递的类型一般是XML和json. ...
- CSS笔记 - fgm练习 2-7 - 简易选项卡
练习地址 http://www.fgm.cc/learn/lesson2/07.html <style> body,ul,li{margin:0;padding:0;} body{font ...
- [React Intl] Format a Date Relative to the Current Date Using react-intl FormattedRelative
Given a date, we’ll use the react-intl FormattedRelative component to render a date in a human reada ...
- UILabel基本用法
UILabel *_label = [[UILabel alloc]initWithFrame:CGRectMake(, self.view.frame.size.height*)]; _label. ...
- GCD下载后清除缓存
//GCD下载后清除缓存1 —(void)didReceiveMemoryWarning{ [super didReceiveMemoryWarning]; //清除缓存 [self.cache re ...
- PatentTips - Data Plane Packet Processing Tool Chain
BACKGROUND The present disclosure relates generally to systems and methods for providing a data plan ...
- [Angular] Bind async requests in your Angular template with the async pipe and the "as" keyword
Angular allows us to conveniently use the async pipe to automatically register to RxJS observables a ...
- (十一)RabbitMQ消息队列-如何实现高可用
原文:(十一)RabbitMQ消息队列-如何实现高可用 在前面讲到了RabbitMQ高可用集群的搭建,但是我们知道只是集群的高可用并不能保证应用在使用消息队列时完全没有问题,例如如果应用连接的Rabb ...
- A Guide to Python's Magic Methods
Book Source:[https://rszalski.github.io/magicmethods/] magic methods: 名称前后有双下划线的方法 构造函数和初始化 初始化类实例时, ...
- php实现求数组中出现次数超过一半的数字(isset($arr[$val]))(取不同数看剩)(排序取中)
php实现求数组中出现次数超过一半的数字(isset($arr[$val]))(取不同数看剩)(排序取中) 一.总结 1.if(isset($arr[$val])) $arr[$val]++; //1 ...