Or the problem that QT uses stylesheet or palette to set the background color

Source: Internet
Author: User

For QT, after setting the background color of a widget, you want the sub-objects to be unaffected. A long time ago I asked a question on qtforum: http://www.qtforum.org/post/94103/setting-background-color-on-widgets-makes-child-widget-wrong-style.html? Highlight = # post94103

There is a similar problem in stackoverflow: http://stackoverflow.com/questions/177778/in-qt-how-do-i-set-the-background-color-of-a-widget-like-combobox-or-double-spin

 

The current method is:

1. If you set the entire dialog box, use the palette

2. If you set an object, use selector.

Class Selector . Qpushbutton Matches instances 
Qpushbutton
, But not of its subclasses.

This is equivalent 
* [Class ~ = "Qpushbutton"]
.

Or

ID 

Selector
Qpushbutton # okbutton Matches all 
Qpushbutton
 
Instances whose 
Object Name
 
Is 
Okbutton
.

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.