[−][src]Struct qt_gui::QColor
The QColor class provides colors based on RGB, HSV or CMYK values.
C++ class: QColor
.
The QColor class provides colors based on RGB, HSV or CMYK values.
A color is normally specified in terms of RGB (red, green, and blue) components, but it is also possible to specify it in terms of HSV (hue, saturation, and value) and CMYK (cyan, magenta, yellow and black) components. In addition a color can be specified using a color name. The color name can be any of the SVG 1.0 color names.
RGB | HSV | CMYK |
---|---|---|
The QColor constructor creates the color based on RGB values. To create a QColor based on either HSV or CMYK values, use the toHsv() and toCmyk() functions respectively. These functions return a copy of the color using the desired format. In addition the static fromRgb(), fromHsv() and fromCmyk() functions create colors from the specified values. Alternatively, a color can be converted to any of the three formats using the convertTo() function (returning a copy of the color in the desired format), or any of the setRgb(), setHsv() and setCmyk() functions altering this color's format. The spec() function tells how the color was specified.
A color can be set by passing an RGB string (such as "#112233"), or an ARGB string (such as "#ff112233") or a color name (such as "blue"), to the setNamedColor() function. The color names are taken from the SVG 1.0 color names. The name() function returns the name of the color in the format "#RRGGBB". Colors can also be set using setRgb(), setHsv() and setCmyk(). To get a lighter or darker color use the lighter() and darker() functions respectively.
The isValid() function indicates whether a QColor is legal at all. For example, a RGB color with RGB values out of range is illegal. For performance reasons, QColor mostly disregards illegal colors, and for that reason, the result of using an invalid color is undefined.
The color components can be retrieved individually, e.g with red(), hue() and cyan(). The values of the color components can also be retrieved in one go using the getRgb(), getHsv() and getCmyk() functions. Using the RGB color model, the color components can in addition be accessed with rgb().
There are several related non-members: QRgb is a typdef for an unsigned int representing the RGB value triplet (r, g, b). Note that it also can hold a value for the alpha-channel (for more information, see the Alpha-Blended Drawing section). The qRed(), qBlue() and qGreen() functions return the respective component of the given QRgb value, while the qRgb() and qRgba() functions create and return the QRgb triplet based on the given component values. Finally, the qAlpha() function returns the alpha component of the provided QRgb, and the qGray() function calculates and return a gray value based on the given value.
QColor is platform and device independent. The QColormap class maps the color to the hardware.
For more information about painting in general, see the Paint System documentation.
Methods
impl QColor
[src]
pub unsafe fn alpha(&self) -> c_int
[src]
Returns the alpha color component of this color.
Calls C++ function: int QColor::alpha() const
.
Returns the alpha color component of this color.
See also setAlpha(), alphaF(), and Alpha-Blended Drawing.
pub unsafe fn alpha_f(&self) -> c_double
[src]
Returns the alpha color component of this color.
Calls C++ function: double QColor::alphaF() const
.
Returns the alpha color component of this color.
See also setAlphaF(), alpha(), and Alpha-Blended Drawing.
pub unsafe fn black(&self) -> c_int
[src]
Returns the black color component of this color.
Calls C++ function: int QColor::black() const
.
Returns the black color component of this color.
See also blackF(), getCmyk(), and The CMYK Color Model.
pub unsafe fn black_f(&self) -> c_double
[src]
Returns the black color component of this color.
Calls C++ function: double QColor::blackF() const
.
Returns the black color component of this color.
See also black(), getCmykF(), and The CMYK Color Model.
pub unsafe fn blue(&self) -> c_int
[src]
Returns the blue color component of this color.
Calls C++ function: int QColor::blue() const
.
pub unsafe fn blue_f(&self) -> c_double
[src]
Returns the blue color component of this color.
Calls C++ function: double QColor::blueF() const
.
pub unsafe fn color_names() -> CppBox<QStringList>
[src]
Returns a QStringList containing the color names Qt knows about.
Calls C++ function: static QStringList QColor::colorNames()
.
Returns a QStringList containing the color names Qt knows about.
See also Predefined Colors.
pub unsafe fn convert_to(&self, color_spec: Spec) -> CppBox<QColor>
[src]
Creates a copy of this color in the format specified by colorSpec.
Calls C++ function: QColor QColor::convertTo(QColor::Spec colorSpec) const
.
pub unsafe fn copy_from_q_color(
&self,
arg1: impl CastInto<Ref<QColor>>
) -> Ref<QColor>
[src]
&self,
arg1: impl CastInto<Ref<QColor>>
) -> Ref<QColor>
Assigns a copy of color to this color, and returns a reference to it.
Calls C++ function: QColor& QColor::operator=(const QColor& arg1)
.
Assigns a copy of color to this color, and returns a reference to it.
pub unsafe fn copy_from_global_color(&self, color: GlobalColor) -> Ref<QColor>
[src]
This is an overloaded function.
Calls C++ function: QColor& QColor::operator=(Qt::GlobalColor color)
.
This is an overloaded function.
Assigns a copy of color and returns a reference to this color.
pub unsafe fn cyan(&self) -> c_int
[src]
Returns the cyan color component of this color.
Calls C++ function: int QColor::cyan() const
.
Returns the cyan color component of this color.
See also cyanF(), getCmyk(), and The CMYK Color Model.
pub unsafe fn cyan_f(&self) -> c_double
[src]
Returns the cyan color component of this color.
Calls C++ function: double QColor::cyanF() const
.
Returns the cyan color component of this color.
See also cyan(), getCmykF(), and The CMYK Color Model.
pub unsafe fn dark_1a(&self, f: c_int) -> CppBox<QColor>
[src]
Use darker(factor) instead.
Calls C++ function: QColor QColor::dark(int f = …) const
.
Use darker(factor) instead.
pub unsafe fn dark_0a(&self) -> CppBox<QColor>
[src]
Use darker(factor) instead.
Calls C++ function: QColor QColor::dark() const
.
Use darker(factor) instead.
pub unsafe fn darker_1a(&self, f: c_int) -> CppBox<QColor>
[src]
Returns a darker (or lighter) color, but does not change this object.
Calls C++ function: QColor QColor::darker(int f = …) const
.
Returns a darker (or lighter) color, but does not change this object.
If the factor is greater than 100, this functions returns a darker color. Setting factor to 300 returns a color that has one-third the brightness. If the factor is less than 100, the return color is lighter, but we recommend using the lighter() function for this purpose. If the factor is 0 or negative, the return value is unspecified.
The function converts the current RGB color to HSV, divides the value (V) component by factor and converts the color back to RGB.
This function was introduced in Qt 4.3.
pub unsafe fn darker_0a(&self) -> CppBox<QColor>
[src]
Returns a darker (or lighter) color, but does not change this object.
Calls C++ function: QColor QColor::darker() const
.
Returns a darker (or lighter) color, but does not change this object.
If the factor is greater than 100, this functions returns a darker color. Setting factor to 300 returns a color that has one-third the brightness. If the factor is less than 100, the return color is lighter, but we recommend using the lighter() function for this purpose. If the factor is 0 or negative, the return value is unspecified.
The function converts the current RGB color to HSV, divides the value (V) component by factor and converts the color back to RGB.
This function was introduced in Qt 4.3.
pub unsafe fn from_cmyk_5a(
c: c_int,
m: c_int,
y: c_int,
k: c_int,
a: c_int
) -> CppBox<QColor>
[src]
c: c_int,
m: c_int,
y: c_int,
k: c_int,
a: c_int
) -> CppBox<QColor>
Static convenience function that returns a QColor constructed from the given CMYK color values: c (cyan), m (magenta), y (yellow), k (black), and a (alpha-channel, i.e. transparency).
Calls C++ function: static QColor QColor::fromCmyk(int c, int m, int y, int k, int a = …)
.
Static convenience function that returns a QColor constructed from the given CMYK color values: c (cyan), m (magenta), y (yellow), k (black), and a (alpha-channel, i.e. transparency).
All the values must be in the range 0-255.
See also toCmyk(), fromCmykF(), isValid(), and The CMYK Color Model.
pub unsafe fn from_cmyk_4a(
c: c_int,
m: c_int,
y: c_int,
k: c_int
) -> CppBox<QColor>
[src]
c: c_int,
m: c_int,
y: c_int,
k: c_int
) -> CppBox<QColor>
Static convenience function that returns a QColor constructed from the given CMYK color values: c (cyan), m (magenta), y (yellow), k (black), and a (alpha-channel, i.e. transparency).
Calls C++ function: static QColor QColor::fromCmyk(int c, int m, int y, int k)
.
Static convenience function that returns a QColor constructed from the given CMYK color values: c (cyan), m (magenta), y (yellow), k (black), and a (alpha-channel, i.e. transparency).
All the values must be in the range 0-255.
See also toCmyk(), fromCmykF(), isValid(), and The CMYK Color Model.
pub unsafe fn from_cmyk_f_5a(
c: c_double,
m: c_double,
y: c_double,
k: c_double,
a: c_double
) -> CppBox<QColor>
[src]
c: c_double,
m: c_double,
y: c_double,
k: c_double,
a: c_double
) -> CppBox<QColor>
This is an overloaded function.
Calls C++ function: static QColor QColor::fromCmykF(double c, double m, double y, double k, double a = …)
.
This is an overloaded function.
Static convenience function that returns a QColor constructed from the given CMYK color values: c (cyan), m (magenta), y (yellow), k (black), and a (alpha-channel, i.e. transparency).
All the values must be in the range 0.0-1.0.
See also toCmyk(), fromCmyk(), isValid(), and The CMYK Color Model.
pub unsafe fn from_cmyk_f_4a(
c: c_double,
m: c_double,
y: c_double,
k: c_double
) -> CppBox<QColor>
[src]
c: c_double,
m: c_double,
y: c_double,
k: c_double
) -> CppBox<QColor>
This is an overloaded function.
Calls C++ function: static QColor QColor::fromCmykF(double c, double m, double y, double k)
.
This is an overloaded function.
Static convenience function that returns a QColor constructed from the given CMYK color values: c (cyan), m (magenta), y (yellow), k (black), and a (alpha-channel, i.e. transparency).
All the values must be in the range 0.0-1.0.
See also toCmyk(), fromCmyk(), isValid(), and The CMYK Color Model.
pub unsafe fn from_hsl_4a(
h: c_int,
s: c_int,
l: c_int,
a: c_int
) -> CppBox<QColor>
[src]
h: c_int,
s: c_int,
l: c_int,
a: c_int
) -> CppBox<QColor>
Static convenience function that returns a QColor constructed from the HSV color values, h (hue), s (saturation), l (lightness), and a (alpha-channel, i.e. transparency).
Calls C++ function: static QColor QColor::fromHsl(int h, int s, int l, int a = …)
.
Static convenience function that returns a QColor constructed from the HSV color values, h (hue), s (saturation), l (lightness), and a (alpha-channel, i.e. transparency).
The value of s, l, and a must all be in the range 0-255; the value of h must be in the range 0-359.
This function was introduced in Qt 4.6.
pub unsafe fn from_hsl_3a(h: c_int, s: c_int, l: c_int) -> CppBox<QColor>
[src]
Static convenience function that returns a QColor constructed from the HSV color values, h (hue), s (saturation), l (lightness), and a (alpha-channel, i.e. transparency).
Calls C++ function: static QColor QColor::fromHsl(int h, int s, int l)
.
Static convenience function that returns a QColor constructed from the HSV color values, h (hue), s (saturation), l (lightness), and a (alpha-channel, i.e. transparency).
The value of s, l, and a must all be in the range 0-255; the value of h must be in the range 0-359.
This function was introduced in Qt 4.6.
pub unsafe fn from_hsl_f_4a(
h: c_double,
s: c_double,
l: c_double,
a: c_double
) -> CppBox<QColor>
[src]
h: c_double,
s: c_double,
l: c_double,
a: c_double
) -> CppBox<QColor>
This is an overloaded function.
Calls C++ function: static QColor QColor::fromHslF(double h, double s, double l, double a = …)
.
This is an overloaded function.
Static convenience function that returns a QColor constructed from the HSV color values, h (hue), s (saturation), l (lightness), and a (alpha-channel, i.e. transparency).
All the values must be in the range 0.0-1.0.
This function was introduced in Qt 4.6.
See also toHsl(), fromHsl(), isValid(), and The HSL Color Model.
pub unsafe fn from_hsl_f_3a(
h: c_double,
s: c_double,
l: c_double
) -> CppBox<QColor>
[src]
h: c_double,
s: c_double,
l: c_double
) -> CppBox<QColor>
This is an overloaded function.
Calls C++ function: static QColor QColor::fromHslF(double h, double s, double l)
.
This is an overloaded function.
Static convenience function that returns a QColor constructed from the HSV color values, h (hue), s (saturation), l (lightness), and a (alpha-channel, i.e. transparency).
All the values must be in the range 0.0-1.0.
This function was introduced in Qt 4.6.
See also toHsl(), fromHsl(), isValid(), and The HSL Color Model.
pub unsafe fn from_hsv_4a(
h: c_int,
s: c_int,
v: c_int,
a: c_int
) -> CppBox<QColor>
[src]
h: c_int,
s: c_int,
v: c_int,
a: c_int
) -> CppBox<QColor>
Static convenience function that returns a QColor constructed from the HSV color values, h (hue), s (saturation), v (value), and a (alpha-channel, i.e. transparency).
Calls C++ function: static QColor QColor::fromHsv(int h, int s, int v, int a = …)
.
Static convenience function that returns a QColor constructed from the HSV color values, h (hue), s (saturation), v (value), and a (alpha-channel, i.e. transparency).
The value of s, v, and a must all be in the range 0-255; the value of h must be in the range 0-359.
See also toHsv(), fromHsvF(), isValid(), and The HSV Color Model.
pub unsafe fn from_hsv_3a(h: c_int, s: c_int, v: c_int) -> CppBox<QColor>
[src]
Static convenience function that returns a QColor constructed from the HSV color values, h (hue), s (saturation), v (value), and a (alpha-channel, i.e. transparency).
Calls C++ function: static QColor QColor::fromHsv(int h, int s, int v)
.
Static convenience function that returns a QColor constructed from the HSV color values, h (hue), s (saturation), v (value), and a (alpha-channel, i.e. transparency).
The value of s, v, and a must all be in the range 0-255; the value of h must be in the range 0-359.
See also toHsv(), fromHsvF(), isValid(), and The HSV Color Model.
pub unsafe fn from_hsv_f_4a(
h: c_double,
s: c_double,
v: c_double,
a: c_double
) -> CppBox<QColor>
[src]
h: c_double,
s: c_double,
v: c_double,
a: c_double
) -> CppBox<QColor>
This is an overloaded function.
Calls C++ function: static QColor QColor::fromHsvF(double h, double s, double v, double a = …)
.
This is an overloaded function.
Static convenience function that returns a QColor constructed from the HSV color values, h (hue), s (saturation), v (value), and a (alpha-channel, i.e. transparency).
All the values must be in the range 0.0-1.0.
See also toHsv(), fromHsv(), isValid(), and The HSV Color Model.
pub unsafe fn from_hsv_f_3a(
h: c_double,
s: c_double,
v: c_double
) -> CppBox<QColor>
[src]
h: c_double,
s: c_double,
v: c_double
) -> CppBox<QColor>
This is an overloaded function.
Calls C++ function: static QColor QColor::fromHsvF(double h, double s, double v)
.
This is an overloaded function.
Static convenience function that returns a QColor constructed from the HSV color values, h (hue), s (saturation), v (value), and a (alpha-channel, i.e. transparency).
All the values must be in the range 0.0-1.0.
See also toHsv(), fromHsv(), isValid(), and The HSV Color Model.
pub unsafe fn from_rgb_1a(rgb: c_uint) -> CppBox<QColor>
[src]
Static convenience function that returns a QColor constructed from the given QRgb value rgb.
Calls C++ function: static QColor QColor::fromRgb(unsigned int rgb)
.
pub unsafe fn from_rgb_4a(
r: c_int,
g: c_int,
b: c_int,
a: c_int
) -> CppBox<QColor>
[src]
r: c_int,
g: c_int,
b: c_int,
a: c_int
) -> CppBox<QColor>
Static convenience function that returns a QColor constructed from the RGB color values, r (red), g (green), b (blue), and a (alpha-channel, i.e. transparency).
Calls C++ function: static QColor QColor::fromRgb(int r, int g, int b, int a = …)
.
Static convenience function that returns a QColor constructed from the RGB color values, r (red), g (green), b (blue), and a (alpha-channel, i.e. transparency).
All the values must be in the range 0-255.
See also toRgb(), fromRgba64(), fromRgbF(), and isValid().
pub unsafe fn from_rgb_3a(r: c_int, g: c_int, b: c_int) -> CppBox<QColor>
[src]
Static convenience function that returns a QColor constructed from the RGB color values, r (red), g (green), b (blue), and a (alpha-channel, i.e. transparency).
Calls C++ function: static QColor QColor::fromRgb(int r, int g, int b)
.
Static convenience function that returns a QColor constructed from the RGB color values, r (red), g (green), b (blue), and a (alpha-channel, i.e. transparency).
All the values must be in the range 0-255.
See also toRgb(), fromRgba64(), fromRgbF(), and isValid().
pub unsafe fn from_rgb_f_4a(
r: c_double,
g: c_double,
b: c_double,
a: c_double
) -> CppBox<QColor>
[src]
r: c_double,
g: c_double,
b: c_double,
a: c_double
) -> CppBox<QColor>
Static convenience function that returns a QColor constructed from the RGB color values, r (red), g (green), b (blue), and a (alpha-channel, i.e. transparency).
Calls C++ function: static QColor QColor::fromRgbF(double r, double g, double b, double a = …)
.
Static convenience function that returns a QColor constructed from the RGB color values, r (red), g (green), b (blue), and a (alpha-channel, i.e. transparency).
All the values must be in the range 0.0-1.0.
See also fromRgb(), fromRgba64(), toRgb(), and isValid().
pub unsafe fn from_rgb_f_3a(
r: c_double,
g: c_double,
b: c_double
) -> CppBox<QColor>
[src]
r: c_double,
g: c_double,
b: c_double
) -> CppBox<QColor>
Static convenience function that returns a QColor constructed from the RGB color values, r (red), g (green), b (blue), and a (alpha-channel, i.e. transparency).
Calls C++ function: static QColor QColor::fromRgbF(double r, double g, double b)
.
Static convenience function that returns a QColor constructed from the RGB color values, r (red), g (green), b (blue), and a (alpha-channel, i.e. transparency).
All the values must be in the range 0.0-1.0.
See also fromRgb(), fromRgba64(), toRgb(), and isValid().
pub unsafe fn from_rgba(rgba: c_uint) -> CppBox<QColor>
[src]
Static convenience function that returns a QColor constructed from the given QRgb value rgba.
Calls C++ function: static QColor QColor::fromRgba(unsigned int rgba)
.
pub unsafe fn from_rgba64_4a(
r: c_ushort,
g: c_ushort,
b: c_ushort,
a: c_ushort
) -> CppBox<QColor>
[src]
r: c_ushort,
g: c_ushort,
b: c_ushort,
a: c_ushort
) -> CppBox<QColor>
Static convenience function that returns a QColor constructed from the RGBA64 color values, r (red), g (green), b (blue), and a (alpha-channel, i.e. transparency).
Calls C++ function: static QColor QColor::fromRgba64(unsigned short r, unsigned short g, unsigned short b, unsigned short a = …)
.
pub unsafe fn from_rgba64_1a(
rgba: impl CastInto<Ref<QRgba64>>
) -> CppBox<QColor>
[src]
rgba: impl CastInto<Ref<QRgba64>>
) -> CppBox<QColor>
Static convenience function that returns a QColor constructed from the given QRgba64 value rgba64.
Calls C++ function: static QColor QColor::fromRgba64(QRgba64 rgba)
.
pub unsafe fn from_rgba64_3a(
r: c_ushort,
g: c_ushort,
b: c_ushort
) -> CppBox<QColor>
[src]
r: c_ushort,
g: c_ushort,
b: c_ushort
) -> CppBox<QColor>
Static convenience function that returns a QColor constructed from the RGBA64 color values, r (red), g (green), b (blue), and a (alpha-channel, i.e. transparency).
Calls C++ function: static QColor QColor::fromRgba64(unsigned short r, unsigned short g, unsigned short b)
.
pub unsafe fn get_cmyk_5a_mut(
&self,
c: *mut c_int,
m: *mut c_int,
y: *mut c_int,
k: *mut c_int,
a: *mut c_int
)
[src]
&self,
c: *mut c_int,
m: *mut c_int,
y: *mut c_int,
k: *mut c_int,
a: *mut c_int
)
Sets the contents pointed to by c, m, y, k, and a, to the cyan, magenta, yellow, black, and alpha-channel (transparency) components of the color's CMYK value.
Calls C++ function: void QColor::getCmyk(int* c, int* m, int* y, int* k, int* a = …)
.
Sets the contents pointed to by c, m, y, k, and a, to the cyan, magenta, yellow, black, and alpha-channel (transparency) components of the color's CMYK value.
These components can be retrieved individually using the cyan(), magenta(), yellow(), black() and alpha() functions.
See also setCmyk() and The CMYK Color Model.
pub unsafe fn get_cmyk_4a_mut(
&self,
c: *mut c_int,
m: *mut c_int,
y: *mut c_int,
k: *mut c_int
)
[src]
&self,
c: *mut c_int,
m: *mut c_int,
y: *mut c_int,
k: *mut c_int
)
Sets the contents pointed to by c, m, y, k, and a, to the cyan, magenta, yellow, black, and alpha-channel (transparency) components of the color's CMYK value.
Calls C++ function: void QColor::getCmyk(int* c, int* m, int* y, int* k)
.
Sets the contents pointed to by c, m, y, k, and a, to the cyan, magenta, yellow, black, and alpha-channel (transparency) components of the color's CMYK value.
These components can be retrieved individually using the cyan(), magenta(), yellow(), black() and alpha() functions.
See also setCmyk() and The CMYK Color Model.
pub unsafe fn get_cmyk_5a(
&self,
c: *mut c_int,
m: *mut c_int,
y: *mut c_int,
k: *mut c_int,
a: *mut c_int
)
[src]
&self,
c: *mut c_int,
m: *mut c_int,
y: *mut c_int,
k: *mut c_int,
a: *mut c_int
)
cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Calls C++ function: void QColor::getCmyk(int* c, int* m, int* y, int* k, int* a = …) const
.
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Use the const
overload instead.
pub unsafe fn get_cmyk_4a(
&self,
c: *mut c_int,
m: *mut c_int,
y: *mut c_int,
k: *mut c_int
)
[src]
&self,
c: *mut c_int,
m: *mut c_int,
y: *mut c_int,
k: *mut c_int
)
cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Calls C++ function: void QColor::getCmyk(int* c, int* m, int* y, int* k) const
.
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Use the const
overload instead.
pub unsafe fn get_cmyk_f_5a_mut(
&self,
c: *mut c_double,
m: *mut c_double,
y: *mut c_double,
k: *mut c_double,
a: *mut c_double
)
[src]
&self,
c: *mut c_double,
m: *mut c_double,
y: *mut c_double,
k: *mut c_double,
a: *mut c_double
)
Sets the contents pointed to by c, m, y, k, and a, to the cyan, magenta, yellow, black, and alpha-channel (transparency) components of the color's CMYK value.
Calls C++ function: void QColor::getCmykF(double* c, double* m, double* y, double* k, double* a = …)
.
Sets the contents pointed to by c, m, y, k, and a, to the cyan, magenta, yellow, black, and alpha-channel (transparency) components of the color's CMYK value.
These components can be retrieved individually using the cyanF(), magentaF(), yellowF(), blackF() and alphaF() functions.
See also setCmykF() and The CMYK Color Model.
pub unsafe fn get_cmyk_f_4a_mut(
&self,
c: *mut c_double,
m: *mut c_double,
y: *mut c_double,
k: *mut c_double
)
[src]
&self,
c: *mut c_double,
m: *mut c_double,
y: *mut c_double,
k: *mut c_double
)
Sets the contents pointed to by c, m, y, k, and a, to the cyan, magenta, yellow, black, and alpha-channel (transparency) components of the color's CMYK value.
Calls C++ function: void QColor::getCmykF(double* c, double* m, double* y, double* k)
.
Sets the contents pointed to by c, m, y, k, and a, to the cyan, magenta, yellow, black, and alpha-channel (transparency) components of the color's CMYK value.
These components can be retrieved individually using the cyanF(), magentaF(), yellowF(), blackF() and alphaF() functions.
See also setCmykF() and The CMYK Color Model.
pub unsafe fn get_cmyk_f_5a(
&self,
c: *mut c_double,
m: *mut c_double,
y: *mut c_double,
k: *mut c_double,
a: *mut c_double
)
[src]
&self,
c: *mut c_double,
m: *mut c_double,
y: *mut c_double,
k: *mut c_double,
a: *mut c_double
)
cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Calls C++ function: void QColor::getCmykF(double* c, double* m, double* y, double* k, double* a = …) const
.
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Use the const
overload instead.
pub unsafe fn get_cmyk_f_4a(
&self,
c: *mut c_double,
m: *mut c_double,
y: *mut c_double,
k: *mut c_double
)
[src]
&self,
c: *mut c_double,
m: *mut c_double,
y: *mut c_double,
k: *mut c_double
)
cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Calls C++ function: void QColor::getCmykF(double* c, double* m, double* y, double* k) const
.
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Use the const
overload instead.
pub unsafe fn get_hsl_4a(
&self,
h: *mut c_int,
s: *mut c_int,
l: *mut c_int,
a: *mut c_int
)
[src]
&self,
h: *mut c_int,
s: *mut c_int,
l: *mut c_int,
a: *mut c_int
)
Sets the contents pointed to by h, s, l, and a, to the hue, saturation, lightness, and alpha-channel (transparency) components of the color's HSL value.
Calls C++ function: void QColor::getHsl(int* h, int* s, int* l, int* a = …) const
.
Sets the contents pointed to by h, s, l, and a, to the hue, saturation, lightness, and alpha-channel (transparency) components of the color's HSL value.
These components can be retrieved individually using the hslHue(), hslSaturation(), lightness() and alpha() functions.
This function was introduced in Qt 4.6.
See also setHsl().
pub unsafe fn get_hsl_3a(&self, h: *mut c_int, s: *mut c_int, l: *mut c_int)
[src]
Sets the contents pointed to by h, s, l, and a, to the hue, saturation, lightness, and alpha-channel (transparency) components of the color's HSL value.
Calls C++ function: void QColor::getHsl(int* h, int* s, int* l) const
.
Sets the contents pointed to by h, s, l, and a, to the hue, saturation, lightness, and alpha-channel (transparency) components of the color's HSL value.
These components can be retrieved individually using the hslHue(), hslSaturation(), lightness() and alpha() functions.
This function was introduced in Qt 4.6.
See also setHsl().
pub unsafe fn get_hsl_f_4a(
&self,
h: *mut c_double,
s: *mut c_double,
l: *mut c_double,
a: *mut c_double
)
[src]
&self,
h: *mut c_double,
s: *mut c_double,
l: *mut c_double,
a: *mut c_double
)
Sets the contents pointed to by h, s, l, and a, to the hue, saturation, lightness, and alpha-channel (transparency) components of the color's HSL value.
Calls C++ function: void QColor::getHslF(double* h, double* s, double* l, double* a = …) const
.
Sets the contents pointed to by h, s, l, and a, to the hue, saturation, lightness, and alpha-channel (transparency) components of the color's HSL value.
These components can be retrieved individually using the hslHueF(), hslSaturationF(), lightnessF() and alphaF() functions.
This function was introduced in Qt 4.6.
See also setHsl().
pub unsafe fn get_hsl_f_3a(
&self,
h: *mut c_double,
s: *mut c_double,
l: *mut c_double
)
[src]
&self,
h: *mut c_double,
s: *mut c_double,
l: *mut c_double
)
Sets the contents pointed to by h, s, l, and a, to the hue, saturation, lightness, and alpha-channel (transparency) components of the color's HSL value.
Calls C++ function: void QColor::getHslF(double* h, double* s, double* l) const
.
Sets the contents pointed to by h, s, l, and a, to the hue, saturation, lightness, and alpha-channel (transparency) components of the color's HSL value.
These components can be retrieved individually using the hslHueF(), hslSaturationF(), lightnessF() and alphaF() functions.
This function was introduced in Qt 4.6.
See also setHsl().
pub unsafe fn get_hsv_4a(
&self,
h: *mut c_int,
s: *mut c_int,
v: *mut c_int,
a: *mut c_int
)
[src]
&self,
h: *mut c_int,
s: *mut c_int,
v: *mut c_int,
a: *mut c_int
)
Sets the contents pointed to by h, s, v, and a, to the hue, saturation, value, and alpha-channel (transparency) components of the color's HSV value.
Calls C++ function: void QColor::getHsv(int* h, int* s, int* v, int* a = …) const
.
Sets the contents pointed to by h, s, v, and a, to the hue, saturation, value, and alpha-channel (transparency) components of the color's HSV value.
These components can be retrieved individually using the hue(), saturation(), value() and alpha() functions.
See also setHsv() and The HSV Color Model.
pub unsafe fn get_hsv_3a(&self, h: *mut c_int, s: *mut c_int, v: *mut c_int)
[src]
Sets the contents pointed to by h, s, v, and a, to the hue, saturation, value, and alpha-channel (transparency) components of the color's HSV value.
Calls C++ function: void QColor::getHsv(int* h, int* s, int* v) const
.
Sets the contents pointed to by h, s, v, and a, to the hue, saturation, value, and alpha-channel (transparency) components of the color's HSV value.
These components can be retrieved individually using the hue(), saturation(), value() and alpha() functions.
See also setHsv() and The HSV Color Model.
pub unsafe fn get_hsv_f_4a(
&self,
h: *mut c_double,
s: *mut c_double,
v: *mut c_double,
a: *mut c_double
)
[src]
&self,
h: *mut c_double,
s: *mut c_double,
v: *mut c_double,
a: *mut c_double
)
Sets the contents pointed to by h, s, v, and a, to the hue, saturation, value, and alpha-channel (transparency) components of the color's HSV value.
Calls C++ function: void QColor::getHsvF(double* h, double* s, double* v, double* a = …) const
.
Sets the contents pointed to by h, s, v, and a, to the hue, saturation, value, and alpha-channel (transparency) components of the color's HSV value.
These components can be retrieved individually using the hueF(), saturationF(), valueF() and alphaF() functions.
See also setHsv() and The HSV Color Model.
pub unsafe fn get_hsv_f_3a(
&self,
h: *mut c_double,
s: *mut c_double,
v: *mut c_double
)
[src]
&self,
h: *mut c_double,
s: *mut c_double,
v: *mut c_double
)
Sets the contents pointed to by h, s, v, and a, to the hue, saturation, value, and alpha-channel (transparency) components of the color's HSV value.
Calls C++ function: void QColor::getHsvF(double* h, double* s, double* v) const
.
Sets the contents pointed to by h, s, v, and a, to the hue, saturation, value, and alpha-channel (transparency) components of the color's HSV value.
These components can be retrieved individually using the hueF(), saturationF(), valueF() and alphaF() functions.
See also setHsv() and The HSV Color Model.
pub unsafe fn get_rgb_4a(
&self,
r: *mut c_int,
g: *mut c_int,
b: *mut c_int,
a: *mut c_int
)
[src]
&self,
r: *mut c_int,
g: *mut c_int,
b: *mut c_int,
a: *mut c_int
)
Sets the contents pointed to by r, g, b, and a, to the red, green, blue, and alpha-channel (transparency) components of the color's RGB value.
Calls C++ function: void QColor::getRgb(int* r, int* g, int* b, int* a = …) const
.
pub unsafe fn get_rgb_3a(&self, r: *mut c_int, g: *mut c_int, b: *mut c_int)
[src]
Sets the contents pointed to by r, g, b, and a, to the red, green, blue, and alpha-channel (transparency) components of the color's RGB value.
Calls C++ function: void QColor::getRgb(int* r, int* g, int* b) const
.
pub unsafe fn get_rgb_f_4a(
&self,
r: *mut c_double,
g: *mut c_double,
b: *mut c_double,
a: *mut c_double
)
[src]
&self,
r: *mut c_double,
g: *mut c_double,
b: *mut c_double,
a: *mut c_double
)
Sets the contents pointed to by r, g, b, and a, to the red, green, blue, and alpha-channel (transparency) components of the color's RGB value.
Calls C++ function: void QColor::getRgbF(double* r, double* g, double* b, double* a = …) const
.
pub unsafe fn get_rgb_f_3a(
&self,
r: *mut c_double,
g: *mut c_double,
b: *mut c_double
)
[src]
&self,
r: *mut c_double,
g: *mut c_double,
b: *mut c_double
)
Sets the contents pointed to by r, g, b, and a, to the red, green, blue, and alpha-channel (transparency) components of the color's RGB value.
Calls C++ function: void QColor::getRgbF(double* r, double* g, double* b) const
.
pub unsafe fn green(&self) -> c_int
[src]
Returns the green color component of this color.
Calls C++ function: int QColor::green() const
.
pub unsafe fn green_f(&self) -> c_double
[src]
Returns the green color component of this color.
Calls C++ function: double QColor::greenF() const
.
pub unsafe fn hsl_hue(&self) -> c_int
[src]
Returns the hue color component of this color.
Calls C++ function: int QColor::hslHue() const
.
pub unsafe fn hsl_hue_f(&self) -> c_double
[src]
Returns the hue color component of this color.
Calls C++ function: double QColor::hslHueF() const
.
pub unsafe fn hsl_saturation(&self) -> c_int
[src]
Returns the saturation color component of this color.
Calls C++ function: int QColor::hslSaturation() const
.
Returns the saturation color component of this color.
This function was introduced in Qt 4.6.
See also saturationF(), getHsv(), and The HSV Color Model.
pub unsafe fn hsl_saturation_f(&self) -> c_double
[src]
Returns the saturation color component of this color.
Calls C++ function: double QColor::hslSaturationF() const
.
Returns the saturation color component of this color.
This function was introduced in Qt 4.6.
See also saturationF() and getHslF().
pub unsafe fn hsv_hue(&self) -> c_int
[src]
Returns the hue color component of this color.
Calls C++ function: int QColor::hsvHue() const
.
Returns the hue color component of this color.
See also hueF(), getHsv(), and The HSV Color Model.
pub unsafe fn hsv_hue_f(&self) -> c_double
[src]
Returns the hue color component of this color.
Calls C++ function: double QColor::hsvHueF() const
.
Returns the hue color component of this color.
See also hue(), getHsvF(), and The HSV Color Model.
pub unsafe fn hsv_saturation(&self) -> c_int
[src]
Returns the saturation color component of this color.
Calls C++ function: int QColor::hsvSaturation() const
.
Returns the saturation color component of this color.
See also saturationF(), getHsv(), and The HSV Color Model.
pub unsafe fn hsv_saturation_f(&self) -> c_double
[src]
Returns the saturation color component of this color.
Calls C++ function: double QColor::hsvSaturationF() const
.
Returns the saturation color component of this color.
See also saturation(), getHsvF(), and The HSV Color Model.
pub unsafe fn hue(&self) -> c_int
[src]
Returns the hue color component of this color.
Calls C++ function: int QColor::hue() const
.
Returns the hue color component of this color.
The color is implicitly converted to HSV.
See also hsvHue(), hueF(), getHsv(), and The HSV Color Model.
pub unsafe fn hue_f(&self) -> c_double
[src]
Returns the hue color component of this color.
Calls C++ function: double QColor::hueF() const
.
Returns the hue color component of this color.
The color is implicitly converted to HSV.
See also hsvHueF(), hue(), getHsvF(), and The HSV Color Model.
pub unsafe fn is_valid(&self) -> bool
[src]
Returns true
if the color is valid; otherwise returns false
.
Calls C++ function: bool QColor::isValid() const
.
Returns true
if the color is valid; otherwise returns false
.
pub unsafe fn is_valid_color_q_string(name: impl CastInto<Ref<QString>>) -> bool
[src]
Returns true
if the name is a valid color name and can be used to construct a valid QColor object, otherwise returns false.
Calls C++ function: static bool QColor::isValidColor(const QString& name)
.
Returns true
if the name is a valid color name and can be used to construct a valid QColor object, otherwise returns false.
It uses the same algorithm used in setNamedColor().
This function was introduced in Qt 4.7.
See also setNamedColor().
pub unsafe fn is_valid_color_q_latin1_string(
arg1: impl CastInto<Ref<QLatin1String>>
) -> bool
[src]
arg1: impl CastInto<Ref<QLatin1String>>
) -> bool
This is an overloaded function.
Calls C++ function: static bool QColor::isValidColor(QLatin1String arg1)
.
This is an overloaded function.
This function was introduced in Qt 5.8.
pub unsafe fn is_valid_color_q_string_view(
arg1: impl CastInto<Ref<QStringView>>
) -> bool
[src]
arg1: impl CastInto<Ref<QStringView>>
) -> bool
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.This is an overloaded function.
Calls C++ function: static bool QColor::isValidColor(QStringView arg1)
.
This is an overloaded function.
This function was introduced in Qt 5.10.
pub unsafe fn light_1a(&self, f: c_int) -> CppBox<QColor>
[src]
Use lighter(factor) instead.
Calls C++ function: QColor QColor::light(int f = …) const
.
Use lighter(factor) instead.
pub unsafe fn light_0a(&self) -> CppBox<QColor>
[src]
Use lighter(factor) instead.
Calls C++ function: QColor QColor::light() const
.
Use lighter(factor) instead.
pub unsafe fn lighter_1a(&self, f: c_int) -> CppBox<QColor>
[src]
Returns a lighter (or darker) color, but does not change this object.
Calls C++ function: QColor QColor::lighter(int f = …) const
.
Returns a lighter (or darker) color, but does not change this object.
If the factor is greater than 100, this functions returns a lighter color. Setting factor to 150 returns a color that is 50% brighter. If the factor is less than 100, the return color is darker, but we recommend using the darker() function for this purpose. If the factor is 0 or negative, the return value is unspecified.
The function converts the current RGB color to HSV, multiplies the value (V) component by factor and converts the color back to RGB.
This function was introduced in Qt 4.3.
pub unsafe fn lighter_0a(&self) -> CppBox<QColor>
[src]
Returns a lighter (or darker) color, but does not change this object.
Calls C++ function: QColor QColor::lighter() const
.
Returns a lighter (or darker) color, but does not change this object.
If the factor is greater than 100, this functions returns a lighter color. Setting factor to 150 returns a color that is 50% brighter. If the factor is less than 100, the return color is darker, but we recommend using the darker() function for this purpose. If the factor is 0 or negative, the return value is unspecified.
The function converts the current RGB color to HSV, multiplies the value (V) component by factor and converts the color back to RGB.
This function was introduced in Qt 4.3.
pub unsafe fn lightness(&self) -> c_int
[src]
Returns the lightness color component of this color.
Calls C++ function: int QColor::lightness() const
.
Returns the lightness color component of this color.
This function was introduced in Qt 4.6.
See also lightnessF() and getHsl().
pub unsafe fn lightness_f(&self) -> c_double
[src]
Returns the lightness color component of this color.
Calls C++ function: double QColor::lightnessF() const
.
pub unsafe fn magenta(&self) -> c_int
[src]
Returns the magenta color component of this color.
Calls C++ function: int QColor::magenta() const
.
Returns the magenta color component of this color.
See also magentaF(), getCmyk(), and The CMYK Color Model.
pub unsafe fn magenta_f(&self) -> c_double
[src]
Returns the magenta color component of this color.
Calls C++ function: double QColor::magentaF() const
.
Returns the magenta color component of this color.
See also magenta(), getCmykF(), and The CMYK Color Model.
pub unsafe fn name_0a(&self) -> CppBox<QString>
[src]
Returns the name of the color in the format "#RRGGBB"; i.e. a "#" character followed by three two-digit hexadecimal numbers.
Calls C++ function: QString QColor::name() const
.
Returns the name of the color in the format "#RRGGBB"; i.e. a "#" character followed by three two-digit hexadecimal numbers.
See also setNamedColor().
pub unsafe fn name_1a(&self, format: NameFormat) -> CppBox<QString>
[src]
Returns the name of the color in the specified format.
Calls C++ function: QString QColor::name(QColor::NameFormat format) const
.
Returns the name of the color in the specified format.
This function was introduced in Qt 5.2.
See also setNamedColor() and NameFormat.
pub unsafe fn new() -> CppBox<QColor>
[src]
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.
Calls C++ function: [constructor] void QColor::QColor()
.
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.
The alpha value of an invalid color is unspecified.
See also isValid().
pub unsafe fn from_global_color(color: GlobalColor) -> CppBox<QColor>
[src]
This is an overloaded function.
Calls C++ function: [constructor] void QColor::QColor(Qt::GlobalColor color)
.
This is an overloaded function.
Constructs a new color with a color value of color.
See also isValid() and Predefined Colors.
pub unsafe fn from_4_int(
r: c_int,
g: c_int,
b: c_int,
a: c_int
) -> CppBox<QColor>
[src]
r: c_int,
g: c_int,
b: c_int,
a: c_int
) -> CppBox<QColor>
Constructs a color with the RGB value r, g, b, and the alpha-channel (transparency) value of a.
Calls C++ function: [constructor] void QColor::QColor(int r, int g, int b, int a = …)
.
pub unsafe fn from_uint(rgb: c_uint) -> CppBox<QColor>
[src]
Constructs a color with the value color. The alpha component is ignored and set to solid.
Calls C++ function: [constructor] void QColor::QColor(unsigned int rgb)
.
pub unsafe fn from_q_rgba64(
rgba64: impl CastInto<Ref<QRgba64>>
) -> CppBox<QColor>
[src]
rgba64: impl CastInto<Ref<QRgba64>>
) -> CppBox<QColor>
Constructs a color with the value rgba64.
Calls C++ function: [constructor] void QColor::QColor(QRgba64 rgba64)
.
Constructs a color with the value rgba64.
This function was introduced in Qt 5.6.
See also fromRgba64().
pub unsafe fn from_q_string(name: impl CastInto<Ref<QString>>) -> CppBox<QColor>
[src]
Constructs a named color in the same way as setNamedColor() using the given name.
Calls C++ function: [constructor] void QColor::QColor(const QString& name)
.
Constructs a named color in the same way as setNamedColor() using the given name.
The color is left invalid if the name cannot be parsed.
See also setNamedColor(), name(), and isValid().
pub unsafe fn from_char(aname: *const c_char) -> CppBox<QColor>
[src]
Constructs a named color in the same way as setNamedColor() using the given name.
Calls C++ function: [constructor] void QColor::QColor(const char* aname)
.
Constructs a named color in the same way as setNamedColor() using the given name.
This is an overloaded function.
See also setNamedColor(), name(), and isValid().
pub unsafe fn from_q_latin1_string(
name: impl CastInto<Ref<QLatin1String>>
) -> CppBox<QColor>
[src]
name: impl CastInto<Ref<QLatin1String>>
) -> CppBox<QColor>
Constructs a named color in the same way as setNamedColor() using the given name.
Calls C++ function: [constructor] void QColor::QColor(QLatin1String name)
.
Constructs a named color in the same way as setNamedColor() using the given name.
This is an overloaded function.
This function was introduced in Qt 5.8.
See also setNamedColor(), name(), and isValid().
pub unsafe fn from_spec(spec: Spec) -> CppBox<QColor>
[src]
Calls C++ function: [constructor] void QColor::QColor(QColor::Spec spec)
.
pub unsafe fn from_3_int(r: c_int, g: c_int, b: c_int) -> CppBox<QColor>
[src]
Constructs a color with the RGB value r, g, b, and the alpha-channel (transparency) value of a.
Calls C++ function: [constructor] void QColor::QColor(int r, int g, int b)
.
pub unsafe fn from_q_string_view(
name: impl CastInto<Ref<QStringView>>
) -> CppBox<QColor>
[src]
name: impl CastInto<Ref<QStringView>>
) -> CppBox<QColor>
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Default constructs an instance of QColor.
Calls C++ function: [constructor] void QColor::QColor(QStringView name)
.
Default constructs an instance of QColor.
pub unsafe fn from_spec5_ushort(
spec: Spec,
a1: c_ushort,
a2: c_ushort,
a3: c_ushort,
a4: c_ushort,
a5: c_ushort
) -> CppBox<QColor>
[src]
spec: Spec,
a1: c_ushort,
a2: c_ushort,
a3: c_ushort,
a4: c_ushort,
a5: c_ushort
) -> CppBox<QColor>
cpp_lib_version="5.14.0"
only.Calls C++ function: [constructor] void QColor::QColor(QColor::Spec spec, unsigned short a1, unsigned short a2, unsigned short a3, unsigned short a4, unsigned short a5 = …)
.
pub unsafe fn from_spec4_ushort(
spec: Spec,
a1: c_ushort,
a2: c_ushort,
a3: c_ushort,
a4: c_ushort
) -> CppBox<QColor>
[src]
spec: Spec,
a1: c_ushort,
a2: c_ushort,
a3: c_ushort,
a4: c_ushort
) -> CppBox<QColor>
cpp_lib_version="5.14.0"
only.Calls C++ function: [constructor] void QColor::QColor(QColor::Spec spec, unsigned short a1, unsigned short a2, unsigned short a3, unsigned short a4)
.
pub unsafe fn new_copy(color: impl CastInto<Ref<QColor>>) -> CppBox<QColor>
[src]
Constructs a color that is a copy of color.
Calls C++ function: [constructor] void QColor::QColor(const QColor& color)
.
Constructs a color that is a copy of color.
See also isValid().
pub unsafe fn red(&self) -> c_int
[src]
Returns the red color component of this color.
Calls C++ function: int QColor::red() const
.
pub unsafe fn red_f(&self) -> c_double
[src]
Returns the red color component of this color.
Calls C++ function: double QColor::redF() const
.
pub unsafe fn rgb(&self) -> c_uint
[src]
Returns the RGB value of the color. The alpha value is opaque.
Calls C++ function: unsigned int QColor::rgb() const
.
pub unsafe fn rgba(&self) -> c_uint
[src]
Returns the RGB value of the color, including its alpha.
Calls C++ function: unsigned int QColor::rgba() const
.
pub unsafe fn rgba64(&self) -> CppBox<QRgba64>
[src]
Returns the RGB64 value of the color, including its alpha.
Calls C++ function: QRgba64 QColor::rgba64() const
.
pub unsafe fn saturation(&self) -> c_int
[src]
Returns the saturation color component of this color.
Calls C++ function: int QColor::saturation() const
.
Returns the saturation color component of this color.
The color is implicitly converted to HSV.
See also hsvSaturation(), saturationF(), getHsv(), and The HSV Color Model.
pub unsafe fn saturation_f(&self) -> c_double
[src]
Returns the saturation color component of this color.
Calls C++ function: double QColor::saturationF() const
.
Returns the saturation color component of this color.
The color is implicitly converted to HSV.
See also hsvSaturationF(), saturation(), getHsvF(), and The HSV Color Model.
pub unsafe fn set_alpha(&self, alpha: c_int)
[src]
Sets the alpha of this color to alpha. Integer alpha is specified in the range 0-255.
Calls C++ function: void QColor::setAlpha(int alpha)
.
Sets the alpha of this color to alpha. Integer alpha is specified in the range 0-255.
See also alpha(), alphaF(), and Alpha-Blended Drawing.
pub unsafe fn set_alpha_f(&self, alpha: c_double)
[src]
Sets the alpha of this color to alpha. qreal alpha is specified in the range 0.0-1.0.
Calls C++ function: void QColor::setAlphaF(double alpha)
.
Sets the alpha of this color to alpha. qreal alpha is specified in the range 0.0-1.0.
See also alphaF(), alpha(), and Alpha-Blended Drawing.
pub unsafe fn set_blue(&self, blue: c_int)
[src]
Sets the blue color component of this color to blue. Integer components are specified in the range 0-255.
Calls C++ function: void QColor::setBlue(int blue)
.
pub unsafe fn set_blue_f(&self, blue: c_double)
[src]
Sets the blue color component of this color to blue. Float components are specified in the range 0.0-1.0.
Calls C++ function: void QColor::setBlueF(double blue)
.
pub unsafe fn set_cmyk_5a(
&self,
c: c_int,
m: c_int,
y: c_int,
k: c_int,
a: c_int
)
[src]
&self,
c: c_int,
m: c_int,
y: c_int,
k: c_int,
a: c_int
)
Sets the color to CMYK values, c (cyan), m (magenta), y (yellow), k (black), and a (alpha-channel, i.e. transparency).
Calls C++ function: void QColor::setCmyk(int c, int m, int y, int k, int a = …)
.
Sets the color to CMYK values, c (cyan), m (magenta), y (yellow), k (black), and a (alpha-channel, i.e. transparency).
All the values must be in the range 0-255.
See also getCmyk(), setCmykF(), and The CMYK Color Model.
pub unsafe fn set_cmyk_4a(&self, c: c_int, m: c_int, y: c_int, k: c_int)
[src]
Sets the color to CMYK values, c (cyan), m (magenta), y (yellow), k (black), and a (alpha-channel, i.e. transparency).
Calls C++ function: void QColor::setCmyk(int c, int m, int y, int k)
.
Sets the color to CMYK values, c (cyan), m (magenta), y (yellow), k (black), and a (alpha-channel, i.e. transparency).
All the values must be in the range 0-255.
See also getCmyk(), setCmykF(), and The CMYK Color Model.
pub unsafe fn set_cmyk_f_5a(
&self,
c: c_double,
m: c_double,
y: c_double,
k: c_double,
a: c_double
)
[src]
&self,
c: c_double,
m: c_double,
y: c_double,
k: c_double,
a: c_double
)
This is an overloaded function.
Calls C++ function: void QColor::setCmykF(double c, double m, double y, double k, double a = …)
.
This is an overloaded function.
Sets the color to CMYK values, c (cyan), m (magenta), y (yellow), k (black), and a (alpha-channel, i.e. transparency).
All the values must be in the range 0.0-1.0.
See also getCmykF(), setCmyk(), and The CMYK Color Model.
pub unsafe fn set_cmyk_f_4a(
&self,
c: c_double,
m: c_double,
y: c_double,
k: c_double
)
[src]
&self,
c: c_double,
m: c_double,
y: c_double,
k: c_double
)
This is an overloaded function.
Calls C++ function: void QColor::setCmykF(double c, double m, double y, double k)
.
This is an overloaded function.
Sets the color to CMYK values, c (cyan), m (magenta), y (yellow), k (black), and a (alpha-channel, i.e. transparency).
All the values must be in the range 0.0-1.0.
See also getCmykF(), setCmyk(), and The CMYK Color Model.
pub unsafe fn set_green(&self, green: c_int)
[src]
Sets the green color component of this color to green. Integer components are specified in the range 0-255.
Calls C++ function: void QColor::setGreen(int green)
.
pub unsafe fn set_green_f(&self, green: c_double)
[src]
Sets the green color component of this color to green. Float components are specified in the range 0.0-1.0.
Calls C++ function: void QColor::setGreenF(double green)
.
pub unsafe fn set_hsl_4a(&self, h: c_int, s: c_int, l: c_int, a: c_int)
[src]
Sets a HSL color value; h is the hue, s is the saturation, l is the lightness and a is the alpha component of the HSL color.
Calls C++ function: void QColor::setHsl(int h, int s, int l, int a = …)
.
Sets a HSL color value; h is the hue, s is the saturation, l is the lightness and a is the alpha component of the HSL color.
The saturation, value and alpha-channel values must be in the range 0-255, and the hue value must be greater than -1.
This function was introduced in Qt 4.6.
pub unsafe fn set_hsl_3a(&self, h: c_int, s: c_int, l: c_int)
[src]
Sets a HSL color value; h is the hue, s is the saturation, l is the lightness and a is the alpha component of the HSL color.
Calls C++ function: void QColor::setHsl(int h, int s, int l)
.
Sets a HSL color value; h is the hue, s is the saturation, l is the lightness and a is the alpha component of the HSL color.
The saturation, value and alpha-channel values must be in the range 0-255, and the hue value must be greater than -1.
This function was introduced in Qt 4.6.
pub unsafe fn set_hsl_f_4a(
&self,
h: c_double,
s: c_double,
l: c_double,
a: c_double
)
[src]
&self,
h: c_double,
s: c_double,
l: c_double,
a: c_double
)
Sets a HSL color lightness; h is the hue, s is the saturation, l is the lightness and a is the alpha component of the HSL color.
Calls C++ function: void QColor::setHslF(double h, double s, double l, double a = …)
.
pub unsafe fn set_hsl_f_3a(&self, h: c_double, s: c_double, l: c_double)
[src]
Sets a HSL color lightness; h is the hue, s is the saturation, l is the lightness and a is the alpha component of the HSL color.
Calls C++ function: void QColor::setHslF(double h, double s, double l)
.
pub unsafe fn set_hsv_4a(&self, h: c_int, s: c_int, v: c_int, a: c_int)
[src]
Sets a HSV color value; h is the hue, s is the saturation, v is the value and a is the alpha component of the HSV color.
Calls C++ function: void QColor::setHsv(int h, int s, int v, int a = …)
.
Sets a HSV color value; h is the hue, s is the saturation, v is the value and a is the alpha component of the HSV color.
The saturation, value and alpha-channel values must be in the range 0-255, and the hue value must be greater than -1.
See also getHsv(), setHsvF(), and The HSV Color Model.
pub unsafe fn set_hsv_3a(&self, h: c_int, s: c_int, v: c_int)
[src]
Sets a HSV color value; h is the hue, s is the saturation, v is the value and a is the alpha component of the HSV color.
Calls C++ function: void QColor::setHsv(int h, int s, int v)
.
Sets a HSV color value; h is the hue, s is the saturation, v is the value and a is the alpha component of the HSV color.
The saturation, value and alpha-channel values must be in the range 0-255, and the hue value must be greater than -1.
See also getHsv(), setHsvF(), and The HSV Color Model.
pub unsafe fn set_hsv_f_4a(
&self,
h: c_double,
s: c_double,
v: c_double,
a: c_double
)
[src]
&self,
h: c_double,
s: c_double,
v: c_double,
a: c_double
)
Sets a HSV color value; h is the hue, s is the saturation, v is the value and a is the alpha component of the HSV color.
Calls C++ function: void QColor::setHsvF(double h, double s, double v, double a = …)
.
Sets a HSV color value; h is the hue, s is the saturation, v is the value and a is the alpha component of the HSV color.
All the values must be in the range 0.0-1.0.
See also getHsvF(), setHsv(), and The HSV Color Model.
pub unsafe fn set_hsv_f_3a(&self, h: c_double, s: c_double, v: c_double)
[src]
Sets a HSV color value; h is the hue, s is the saturation, v is the value and a is the alpha component of the HSV color.
Calls C++ function: void QColor::setHsvF(double h, double s, double v)
.
Sets a HSV color value; h is the hue, s is the saturation, v is the value and a is the alpha component of the HSV color.
All the values must be in the range 0.0-1.0.
See also getHsvF(), setHsv(), and The HSV Color Model.
pub unsafe fn set_named_color_q_string(&self, name: impl CastInto<Ref<QString>>)
[src]
Sets the RGB value of this QColor to name, which may be in one of these formats:
Calls C++ function: void QColor::setNamedColor(const QString& name)
.
Sets the RGB value of this QColor to name, which may be in one of these formats:
- #RGB (each of R, G, and B is a single hex digit)
- #RRGGBB
- #AARRGGBB (Since 5.2)
- #RRRGGGBBB
- #RRRRGGGGBBBB
- A name from the list of colors defined in the list of SVG color keyword names provided by the World Wide Web Consortium; for example, "steelblue" or "gainsboro". These color names work on all platforms. Note that these color names are not the same as defined by the Qt::GlobalColor enums, e.g. "green" and Qt::green does not refer to the same color.
transparent
- representing the absence of a color.
The color is invalid if name cannot be parsed.
pub unsafe fn set_named_color_q_latin1_string(
&self,
name: impl CastInto<Ref<QLatin1String>>
)
[src]
&self,
name: impl CastInto<Ref<QLatin1String>>
)
This is an overloaded function.
Calls C++ function: void QColor::setNamedColor(QLatin1String name)
.
This is an overloaded function.
This function was introduced in Qt 5.8.
pub unsafe fn set_named_color_q_string_view(
&self,
name: impl CastInto<Ref<QStringView>>
)
[src]
&self,
name: impl CastInto<Ref<QStringView>>
)
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.This is an overloaded function.
Calls C++ function: void QColor::setNamedColor(QStringView name)
.
This is an overloaded function.
This function was introduced in Qt 5.10.
pub unsafe fn set_red(&self, red: c_int)
[src]
Sets the red color component of this color to red. Integer components are specified in the range 0-255.
Calls C++ function: void QColor::setRed(int red)
.
pub unsafe fn set_red_f(&self, red: c_double)
[src]
Sets the red color component of this color to red. Float components are specified in the range 0.0-1.0.
Calls C++ function: void QColor::setRedF(double red)
.
pub unsafe fn set_rgb_4a(&self, r: c_int, g: c_int, b: c_int, a: c_int)
[src]
Sets the RGB value to r, g, b and the alpha value to a.
Calls C++ function: void QColor::setRgb(int r, int g, int b, int a = …)
.
pub unsafe fn set_rgb_1a(&self, rgb: c_uint)
[src]
This is an overloaded function.
Calls C++ function: void QColor::setRgb(unsigned int rgb)
.
This is an overloaded function.
Sets the RGB value to rgb. The alpha value is set to opaque.
pub unsafe fn set_rgb_3a(&self, r: c_int, g: c_int, b: c_int)
[src]
Sets the RGB value to r, g, b and the alpha value to a.
Calls C++ function: void QColor::setRgb(int r, int g, int b)
.
pub unsafe fn set_rgb_f_4a(
&self,
r: c_double,
g: c_double,
b: c_double,
a: c_double
)
[src]
&self,
r: c_double,
g: c_double,
b: c_double,
a: c_double
)
Sets the color channels of this color to r (red), g (green), b (blue) and a (alpha, transparency).
Calls C++ function: void QColor::setRgbF(double r, double g, double b, double a = …)
.
pub unsafe fn set_rgb_f_3a(&self, r: c_double, g: c_double, b: c_double)
[src]
Sets the color channels of this color to r (red), g (green), b (blue) and a (alpha, transparency).
Calls C++ function: void QColor::setRgbF(double r, double g, double b)
.
pub unsafe fn set_rgba(&self, rgba: c_uint)
[src]
Sets the RGB value to rgba, including its alpha.
Calls C++ function: void QColor::setRgba(unsigned int rgba)
.
pub unsafe fn set_rgba64(&self, rgba: impl CastInto<Ref<QRgba64>>)
[src]
Sets the RGB64 value to rgba, including its alpha.
Calls C++ function: void QColor::setRgba64(QRgba64 rgba)
.
pub unsafe fn spec(&self) -> Spec
[src]
Returns how the color was specified.
Calls C++ function: QColor::Spec QColor::spec() const
.
pub unsafe fn to_cmyk(&self) -> CppBox<QColor>
[src]
Creates and returns a CMYK QColor based on this color.
Calls C++ function: QColor QColor::toCmyk() const
.
Creates and returns a CMYK QColor based on this color.
See also fromCmyk(), convertTo(), isValid(), and The CMYK Color Model.
pub unsafe fn to_extended_rgb(&self) -> CppBox<QColor>
[src]
cpp_lib_version="5.14.0"
only.Create and returns an extended RGB QColor based on this color.
Calls C++ function: QColor QColor::toExtendedRgb() const
.
pub unsafe fn to_hsl(&self) -> CppBox<QColor>
[src]
Creates and returns an HSL QColor based on this color.
Calls C++ function: QColor QColor::toHsl() const
.
pub unsafe fn to_hsv(&self) -> CppBox<QColor>
[src]
Creates and returns an HSV QColor based on this color.
Calls C++ function: QColor QColor::toHsv() const
.
Creates and returns an HSV QColor based on this color.
See also fromHsv(), convertTo(), isValid(), and The HSV Color Model.
pub unsafe fn to_q_variant(&self) -> CppBox<QVariant>
[src]
Returns the color as a QVariant
Calls C++ function: QVariant QColor::operator QVariant() const
.
Returns the color as a QVariant
pub unsafe fn to_rgb(&self) -> CppBox<QColor>
[src]
Create and returns an RGB QColor based on this color.
Calls C++ function: QColor QColor::toRgb() const
.
pub unsafe fn value(&self) -> c_int
[src]
Returns the value color component of this color.
Calls C++ function: int QColor::value() const
.
Returns the value color component of this color.
See also valueF(), getHsv(), and The HSV Color Model.
pub unsafe fn value_f(&self) -> c_double
[src]
Returns the value color component of this color.
Calls C++ function: double QColor::valueF() const
.
Returns the value color component of this color.
See also value(), getHsvF(), and The HSV Color Model.
pub unsafe fn yellow(&self) -> c_int
[src]
Returns the yellow color component of this color.
Calls C++ function: int QColor::yellow() const
.
Returns the yellow color component of this color.
See also yellowF(), getCmyk(), and The CMYK Color Model.
pub unsafe fn yellow_f(&self) -> c_double
[src]
Returns the yellow color component of this color.
Calls C++ function: double QColor::yellowF() const
.
Returns the yellow color component of this color.
See also yellow(), getCmykF(), and The CMYK Color Model.
Trait Implementations
impl CppDeletable for QColor
[src]
unsafe fn delete(&self)
[src]
The QColor class provides colors based on RGB, HSV or CMYK values.
Calls C++ function: [destructor] void QColor::~QColor()
.
The QColor class provides colors based on RGB, HSV or CMYK values.
A color is normally specified in terms of RGB (red, green, and blue) components, but it is also possible to specify it in terms of HSV (hue, saturation, and value) and CMYK (cyan, magenta, yellow and black) components. In addition a color can be specified using a color name. The color name can be any of the SVG 1.0 color names.
RGB | HSV | CMYK |
---|---|---|
The QColor constructor creates the color based on RGB values. To create a QColor based on either HSV or CMYK values, use the toHsv() and toCmyk() functions respectively. These functions return a copy of the color using the desired format. In addition the static fromRgb(), fromHsv() and fromCmyk() functions create colors from the specified values. Alternatively, a color can be converted to any of the three formats using the convertTo() function (returning a copy of the color in the desired format), or any of the setRgb(), setHsv() and setCmyk() functions altering this color's format. The spec() function tells how the color was specified.
A color can be set by passing an RGB string (such as "#112233"), or an ARGB string (such as "#ff112233") or a color name (such as "blue"), to the setNamedColor() function. The color names are taken from the SVG 1.0 color names. The name() function returns the name of the color in the format "#RRGGBB". Colors can also be set using setRgb(), setHsv() and setCmyk(). To get a lighter or darker color use the lighter() and darker() functions respectively.
The isValid() function indicates whether a QColor is legal at all. For example, a RGB color with RGB values out of range is illegal. For performance reasons, QColor mostly disregards illegal colors, and for that reason, the result of using an invalid color is undefined.
The color components can be retrieved individually, e.g with red(), hue() and cyan(). The values of the color components can also be retrieved in one go using the getRgb(), getHsv() and getCmyk() functions. Using the RGB color model, the color components can in addition be accessed with rgb().
There are several related non-members: QRgb is a typdef for an unsigned int representing the RGB value triplet (r, g, b). Note that it also can hold a value for the alpha-channel (for more information, see the Alpha-Blended Drawing section). The qRed(), qBlue() and qGreen() functions return the respective component of the given QRgb value, while the qRgb() and qRgba() functions create and return the QRgb triplet based on the given component values. Finally, the qAlpha() function returns the alpha component of the provided QRgb, and the qGray() function calculates and return a gray value based on the given value.
QColor is platform and device independent. The QColormap class maps the color to the hardware.
For more information about painting in general, see the Paint System documentation.
impl PartialEq<Ref<QColor>> for QColor
[src]
fn eq(&self, c: &Ref<QColor>) -> bool
[src]
Returns true
if this color has the same RGB and alpha values as color; otherwise returns false
.
Calls C++ function: bool QColor::operator==(const QColor& c) const
.
Returns true
if this color has the same RGB and alpha values as color; otherwise returns false
.
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
Auto Trait Implementations
impl RefUnwindSafe for QColor
impl Send for QColor
impl Sync for QColor
impl Unpin for QColor
impl UnwindSafe for QColor
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> CastInto<U> for T where
U: CastFrom<T>,
[src]
U: CastFrom<T>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> StaticUpcast<T> for T
[src]
unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,