首页| 论坛| 消息

标题:求教怎么改变 QLineEdit 、QSpinBox控件的背景色
作者:fourdegree
日期:2011-04-21 13:33
内容:

求教怎么改变 QLineEdit 、QSpinBox控件的背景色,不使用样式表。谢谢中!!


#1 [云中海盗 04-21 14:10]
重写控件咯。。。
#2 [roywillow 04-21 14:11]
改调色板
#3 回 2楼(roywillow) 的帖子 [fourdegree 04-21 14:14]
我改了,但没有效果。QLabel就行。。不知道为什么。
QPalette pal(QColor(255,0,0));
QPalette pp=lineEdit->palette();
//pp.setBrush(QPalette::Active,QPalette::Window,QBrush(Qt::red));
pp.setColor(QPalette::Background,QColor(255,255,0));
label->setPalette(pp);
lineEdit->setPalette(pp);
spinbox->setPalette(pp);
findButton->setPalette(pp);
#4 回 1楼(云中海盗) 的帖子 [fourdegree 04-21 14:16]
那么麻烦啊。。。。。。
#5 [dbzhang800 04-21 14:23]
你提供的信息太少,但这个可能对你有帮助:
Warning: Some styles do not use the palette for all drawing, for instance, if they make use of native theme engines. This is the case for both the Windows XP, Windows Vista, and the Mac OS X styles.

<< 1 2 >> (1/2)

回复 发表
主题 版块