The QColor class provides colors based on RGB. (details) (complete member list)
#include <qcolor.h>
A color is normally specified in terms of RGB (red,green and blue) components, but it is also possible to convert from HSV (hue,saturation and value) or set a color name (X-Windows color database).
There are 19 predefined global QColor objects:
black,
white,
darkGray,
gray,
lightGray,
red,
green,
blue,
cyan,
magenta,
yellow,
darkRed,
darkGreen,
darkBlue,
darkCyan,
darkMagenta,
darkYellow,
color0
and
color1.
The colors color0
(pixel value = 0) and color1
(pixel value = 1) are
special colors for drawing in bitmaps.
The QColor class has an efficient, dynamic color allocation strategy. A color is normally allocated the first time it is used (lazy allocation), that is, whenever the pixel() function is called:
This method seems to work well even with thousands of allocated colors.
See also: QPalette.
Constructs an invalid color with the RGB value (0,0,0). An invalid color is a color that is not properly set up for the underlying window system.
Constructs a color with the RGB value (r,g,b).
Constructs a color with a RGB value and a custom pixel value.
If the pix = 0xffffffff, then the color uses this RGB value in a standard way. If pix is something else, then the pixel value will be set directly to pix (skips the standard allocation procedure).
Constructs a named color.
See also: setNamedColor().
Constructs a color that is a copy of c.
Allocates a pixel value for the current RGB value.
Returns the blue component of the RGB value.
Returns a darker (or lighter) color.
Returns a darker color if factor is greater than 100. Setting factor to 300 returns a color that has one third the brightness.
Returns a lighter color if factor is less than 100, equal to light(100 / factor).
This function converts the current RGB color to HSV, divides V by factor and converts back to RGB.
Returns the current RGB value as HSV.
Arguments:
See also: setHSV().
Returns the RGB value.
Gets the red, green and blue components of the RGB value.
See also: setRGB().
Returns the green component of the RGB value.
Returns TRUE if colors are allocated on-demand. The default setting is TRUE.
See also: setLazyAlloc().
Returns a lighter (or darker) color.
Returns a lighter color if factor is greater than 100. Setting factor to 150 returns a color that is 50% brighter.
Returns a darker color if factor is less than 100, equal to dark(100 / factor).
This function converts the current RGB color to HSV, multiplies V with factor and converts back to RGB.
Returns TRUE if this color has different RGB value from c, or FALSE if they have equal RGB values.
Returns TRUE if this color has the same RGB value as c, or FALSE if they have different RGB values.
Returns the pixel value.
Returns the red component of the RGB value.
Sets a HSV color value.
Arguments:
See also: getHSV().
Enables or disables lazy color allocation.
See also: lazyAlloc().
Sets the RGB value to that of the named color.
This function searches the X color database for the color and sets the RGB value. The color will be set to invalid if such a color does not exist.
Sets the RGB value to (r, g, b).
See also: getRGB().
Sets the RGB value to rgb.
Bits 0-7 = red, bits 8-15 = green, bits 16-23 = blue.
See also: getRGB().
Writes a color object to the stream.
Format: RGB value serialized as UINT32.
Reads a color object from the stream.
This file is part of the Qt toolkit, copyright 1995 Troll Tech, all rights reserved.
It was generated from the following files: