Qtabwiget Change color changes colors (each qwidget has its own palette palette, sets its color, and then Setautofillbackground)

Source: Internet
Author: User

The Qtabwiget class in Qt provides a sticky note control, but the default initialization color of this control is white, and the color of the original window looks very vainly disobey, so we want to set its background color to the background color of the current window. All we have to do is remove the background color of the application window and assign it to each label of the Qtabwiget class, for example, we have the TAB1 and tab2 two tags, to change the background color can be as follows code:

Ui.tab1->setpalette (qwidget::p alette (). Color (This->backgroundrole ())); Ui.tab1->setautofillbackground ( true); Ui.tab2->setpalette (qwidget::p alette (). Color (This->backgroundrole ()));ui.tab2-> Setautofillbackground (TRUE);

If you want to change to a specific color, such as green, you can use the following code:

Ui.tab1->setpalette (* (New Qpalette (Qt::green))); Ui.tab1->setautofillbackground (true);

Http://www.cnblogs.com/grandyang/p/4304624.html

Qtabwiget Change color changes colors (each qwidget has its own palette palette, sets its color, and then Setautofillbackground)

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.