File: QPalette.schelp

package info (click to toggle)
supercollider 1%3A3.13.0%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 80,292 kB
  • sloc: cpp: 476,363; lisp: 84,680; ansic: 77,685; sh: 25,509; python: 7,909; makefile: 3,440; perl: 1,964; javascript: 974; xml: 826; java: 677; yacc: 314; lex: 175; objc: 152; ruby: 136
file content (102 lines) | stat: -rw-r--r-- 4,572 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
class:: QPalette
summary:: Set of colors used by the GUI
categories::  GUI>Accessories


Description::

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 containing 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.

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 explicitly 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 explicitly set on the palette (see link::#-hasColor::). Hence, assigning a new and unmodified palette will reset all the colors to the inherited ones.

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::.

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.

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.



CLASSMETHODS::

METHOD:: new
	Instantiates a new palette, equivalent to the global palette assigned to QtGUI. All colors are considered to not be set (see link::#-hasColor::).

METHOD:: auto
	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::).

	argument:: buttonColor
		The Color assigned to the button role.
	argument:: windowColor
		The Color assigned to the window role.

METHOD:: light
	A predefined palette using light colors. All colors are considered to be set (see link::#-hasColor::).

METHOD:: dark
	A predefined palette using dark colors. All colors are considered to be set (see link::#-hasColor::).

METHOD:: system
	The native system palette. All colors are considered to be set (see link::#-hasColor::).


INSTANCEMETHODS::


PRIVATE:: prInit
PRIVATE:: prAuto
PRIVATE:: prSystem
PRIVATE:: prColor
PRIVATE:: prSetColor
PRIVATE:: prHasColor

METHOD:: color
	Returns the color assigned to a color role within a color group.
	argument:: role
		A symbol among link::Reference/palette_color_roles::.
	argument:: group
		A symbol among link::Reference/palette_color_groups::, or nil, in which case the current color group is used.

METHOD:: setColor
	Assigns a color to a color role within a color group.

	argument:: color
		A Color.
	argument:: role
		A symbol among link::Reference/palette_color_roles::.
	argument:: group
		A symbol among link::Reference/palette_color_groups::, or nil, in which case the color will be assigned to all groups.

METHOD:: hasColor
	Whether the color belonging to a color role and group has been set on this QPalette instance.

	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).

	argument:: role
		A symbol among link::Reference/palette_color_roles::.
	argument:: group
		A symbol among link::Reference/palette_color_groups::.

METHOD:: window
	Convenience method to get or set the color for the 'window' role.

METHOD:: windowText
	Convenience method to get or set the color for the 'windowText' role.

METHOD:: button
	Convenience method to get or set the color for the 'button' role.

METHOD:: buttonText
	Convenience method to get or set the color for the 'buttonText' role.

METHOD:: base
	Convenience method to get or set the color for the 'base' role.

METHOD:: baseText
	Convenience method to get or set the color for the 'baseText' role.

METHOD:: highlight
	Convenience method to get or set the color for the 'highlight' role.

METHOD:: highlightText
	Convenience method to get or set the color for the 'highlightText' role.