2 summary:: Set of colors used by the GUI
3 categories:: GUI>Accessories
8 QPalette is a strong::set of colors:: that the GUI system uses to draw the views. The colors are organized into three strong::color groups:: (active, inactive and disabled) used according to the state of the views drawn, and each group containins one color assigned to each of the various strong::color roles:: (window, windowText, button, buttonText, etc.), used to draw distinct elements of the views. See link::Reference/palette_color_roles:: and link::Reference/palette_color_groups:: for details.
10 A palette can be assigned to the whole GUI using link::Classes/QtGUI#*palette::, or to a particular view using link::Classes/View#-palette::. Views will inherit a palette from their parent, and ultimately QtGUI, unless a palette is explicitely assigned to them. Moreover, when setting a palette on a view, it will be combined with the inherited one, overriding only those colors that have been explicitely set on the palette (see link::#-hasColor::). Hence, assigning a new and unmodified palette will reset all the colors to the inherited ones.
12 There are also two predefined palettes accessible using link::#*light:: and link::#*dark::. The light palette is assigned to QtGUI by default on startup. Should you wish to use a palette that matches the color scheme used natively on your platform, you can access such palette using link::#*system::.
14 If you wish to design your own palette, it is most convenient to use link::#*auto::, which will automatically derive a palette from only two colors, and then modify the details as you see fit.
16 Note that in Qt GUI most color-related methods of views (like link::Classes/Window#-background::, link::Classes/Slider#-knobColor::, etc.) actually modify the view's palette.
23 Instantiates a new palette, equivalent to the global palette assigned to QtGUI. All colors are considered to not be set (see link::#-hasColor::).
26 Instantiates a new palette, with colors automatically derived from the given colors for 'button' and 'window' color roles. All colors are considered to be set (see link::#-hasColor::).
28 argument:: buttonColor
29 The Color assigned to the button role.
30 argument:: windowColor
31 The Color assigned to the window role.
34 A predefined palette using light colors. All colors are considered to be set (see link::#-hasColor::).
37 A predefined palette using dark colors. All colors are considered to be set (see link::#-hasColor::).
40 The native system palette. All colors are considered to be set (see link::#-hasColor::).
54 Returns the color assigned to a color role within a color group.
56 A symbol among link::Reference/palette_color_roles::.
58 A symbol among link::Reference/palette_color_groups::, or nil, in which case the current color group is used.
61 Assigns a color to a color role within a color group.
66 A symbol among link::Reference/palette_color_roles::.
68 A symbol among link::Reference/palette_color_groups::, or nil, in which case the color will be assigned to all groups.
71 Whether the color belonging to a color role and group has been set on this QPalette instance.
73 When setting a palette on a view, only colors for which this methods returns true will be changed, others will be inherited from the parent view (or QtGUI if this view has no parent).
76 A symbol among link::Reference/palette_color_roles::.
78 A symbol among link::Reference/palette_color_groups::.
81 Convenience method to get or set the color for the 'window' role.
84 Convenience method to get or set the color for the 'windowText' role.
87 Convenience method to get or set the color for the 'button' role.
90 Convenience method to get or set the color for the 'buttonText' role.
93 Convenience method to get or set the color for the 'base' role.
96 Convenience method to get or set the color for the 'baseText' role.
99 Convenience method to get or set the color for the 'highlight' role.
101 METHOD:: highlightText
102 Convenience method to get or set the color for the 'highlightText' role.