QPalette设置各种背景色

          设置空间背景色

         setAutoFillBackground(true);  //设置自动填充

    QPalette palette = this->palette();
    palette.setColor(QPalette::Background,Qt::black);
    setPalette(palette);
注:

QPalette::ColorRole

QPalette::Window

10

通常指窗口部件的背景色

QPalette::Background

Window

This value is obsolete. Use Window instead.

QPalette::WindowText

0

通常指窗口不见的前景色;

QPalette::Foreground

WindowText

This value is obsolete. Use WindowText instead.

QPalette::Base

9

指文本输入窗口部件(比如QtextEdit,QLinedit等)的背景色.

QPalette::AlternateBase

16

Used as the alternate background color in views with alternating row colors (seeQAbstractItemView::setAlternatingRowColors()).

QPalette::ToolTipBase

18

提示符背景色

QPalette::ToolTipText

19

提示符前景色

QPalette::Text

6

与QPalette::Base一块使用,指文本输入窗口部件的前景色;

QPalette::Button

1

指按钮窗口部件的背景色;

QPalette::ButtonText

8

指按钮窗口部件的前景色.

QPalette::BrightText

7

A text color that is very different from WindowText, and contrasts well with e.g. Dark. Typically used for text that needs to be drawn where Text or WindowText would give poor contrast, such as on pressed push buttons. Note that text colors can be used for things other than just words; text colors are usually used for text, but it's quite common to use the text color roles for lines, icons, etc.

 

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值