我是靠谱客的博主 贤惠冬日,这篇文章主要介绍QPalette设置各种背景色,现在分享给大家,希望可以做个参考。

          设置空间背景色

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

复制代码
1
QPalette palette = this->palette();
复制代码
1
palette.setColor(QPalette::Background,Qt::black);
复制代码
1
setPalette(palette);
复制代码
1
注:

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.

 

 

最后

以上就是贤惠冬日最近收集整理的关于QPalette设置各种背景色的全部内容,更多相关QPalette设置各种背景色内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(85)

评论列表共有 0 条评论

立即
投稿
返回
顶部