#[repr(C)]pub struct QColor { /* private fields */ }
Expand description
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.
Implementations§
source§impl QColor
impl QColor
sourcepub unsafe fn alpha(&self) -> c_int
pub unsafe fn alpha(&self) -> c_int
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.
sourcepub unsafe fn alpha_f(&self) -> c_double
pub unsafe fn alpha_f(&self) -> c_double
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.
sourcepub unsafe fn black(&self) -> c_int
pub unsafe fn black(&self) -> c_int
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.
sourcepub unsafe fn black_f(&self) -> c_double
pub unsafe fn black_f(&self) -> c_double
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.
sourcepub unsafe fn blue(&self) -> c_int
pub unsafe fn blue(&self) -> c_int
Returns the blue color component of this color.
Calls C++ function: int QColor::blue() const
.
sourcepub unsafe fn blue_f(&self) -> c_double
pub unsafe fn blue_f(&self) -> c_double
Returns the blue color component of this color.
Calls C++ function: double QColor::blueF() const
.
sourcepub unsafe fn color_names() -> CppBox<QStringList>
pub unsafe fn color_names() -> CppBox<QStringList>
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.
sourcepub unsafe fn convert_to(&self, color_spec: Spec) -> CppBox<QColor>
pub unsafe fn convert_to(&self, color_spec: Spec) -> CppBox<QColor>
sourcepub unsafe fn copy_from_q_color(
&self,
arg1: impl CastInto<Ref<QColor>>
) -> Ref<QColor>
pub unsafe fn copy_from_q_color( &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.
sourcepub unsafe fn copy_from_global_color(&self, color: GlobalColor) -> Ref<QColor>
pub unsafe fn copy_from_global_color(&self, color: GlobalColor) -> Ref<QColor>
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.
sourcepub unsafe fn cyan(&self) -> c_int
pub unsafe fn cyan(&self) -> c_int
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.
sourcepub unsafe fn cyan_f(&self) -> c_double
pub unsafe fn cyan_f(&self) -> c_double
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.
sourcepub unsafe fn dark_1a(&self, f: c_int) -> CppBox<QColor>
pub unsafe fn dark_1a(&self, f: c_int) -> CppBox<QColor>
Use darker(factor) instead.
Calls C++ function: QColor QColor::dark(int f = …) const
.
Use darker(factor) instead.
sourcepub unsafe fn dark_0a(&self) -> CppBox<QColor>
pub unsafe fn dark_0a(&self) -> CppBox<QColor>
Use darker(factor) instead.
Calls C++ function: QColor QColor::dark() const
.
Use darker(factor) instead.
sourcepub unsafe fn darker_1a(&self, f: c_int) -> CppBox<QColor>
pub unsafe fn darker_1a(&self, f: c_int) -> CppBox<QColor>
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.
sourcepub unsafe fn darker_0a(&self) -> CppBox<QColor>
pub unsafe fn darker_0a(&self) -> CppBox<QColor>
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.
sourcepub unsafe fn from_cmyk_5a(
c: c_int,
m: c_int,
y: c_int,
k: c_int,
a: c_int
) -> CppBox<QColor>
pub unsafe fn from_cmyk_5a( 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.
sourcepub unsafe fn from_cmyk_4a(
c: c_int,
m: c_int,
y: c_int,
k: c_int
) -> CppBox<QColor>
pub unsafe fn from_cmyk_4a( 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.
sourcepub unsafe fn from_cmyk_f_5a(
c: c_double,
m: c_double,
y: c_double,
k: c_double,
a: c_double
) -> CppBox<QColor>
pub unsafe fn from_cmyk_f_5a( 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.
sourcepub unsafe fn from_cmyk_f_4a(
c: c_double,
m: c_double,
y: c_double,
k: c_double
) -> CppBox<QColor>
pub unsafe fn from_cmyk_f_4a( 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.
sourcepub unsafe fn from_hsl_4a(
h: c_int,
s: c_int,
l: c_int,
a: c_int
) -> CppBox<QColor>
pub unsafe fn from_hsl_4a( 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.
sourcepub unsafe fn from_hsl_3a(h: c_int, s: c_int, l: c_int) -> CppBox<QColor>
pub unsafe fn from_hsl_3a(h: c_int, s: c_int, l: 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)
.
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.
sourcepub unsafe fn from_hsl_f_4a(
h: c_double,
s: c_double,
l: c_double,
a: c_double
) -> CppBox<QColor>
pub unsafe fn from_hsl_f_4a( 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.
sourcepub unsafe fn from_hsl_f_3a(
h: c_double,
s: c_double,
l: c_double
) -> CppBox<QColor>
pub unsafe fn from_hsl_f_3a( 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.
sourcepub unsafe fn from_hsv_4a(
h: c_int,
s: c_int,
v: c_int,
a: c_int
) -> CppBox<QColor>
pub unsafe fn from_hsv_4a( 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.
sourcepub unsafe fn from_hsv_3a(h: c_int, s: c_int, v: c_int) -> CppBox<QColor>
pub unsafe fn from_hsv_3a(h: c_int, s: c_int, v: 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)
.
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.
sourcepub unsafe fn from_hsv_f_4a(
h: c_double,
s: c_double,
v: c_double,
a: c_double
) -> CppBox<QColor>
pub unsafe fn from_hsv_f_4a( 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.
sourcepub unsafe fn from_hsv_f_3a(
h: c_double,
s: c_double,
v: c_double
) -> CppBox<QColor>
pub unsafe fn from_hsv_f_3a( 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.
sourcepub unsafe fn from_rgb_1a(rgb: c_uint) -> CppBox<QColor>
pub unsafe fn from_rgb_1a(rgb: c_uint) -> CppBox<QColor>
Static convenience function that returns a QColor constructed from the given QRgb value rgb.
Calls C++ function: static QColor QColor::fromRgb(unsigned int rgb)
.
sourcepub unsafe fn from_rgb_4a(
r: c_int,
g: c_int,
b: c_int,
a: c_int
) -> CppBox<QColor>
pub unsafe fn from_rgb_4a( 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().
sourcepub unsafe fn from_rgb_3a(r: c_int, g: c_int, b: c_int) -> CppBox<QColor>
pub unsafe fn from_rgb_3a(r: c_int, g: c_int, b: 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)
.
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().
sourcepub unsafe fn from_rgb_f_4a(
r: c_double,
g: c_double,
b: c_double,
a: c_double
) -> CppBox<QColor>
pub unsafe fn from_rgb_f_4a( 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().
sourcepub unsafe fn from_rgb_f_3a(
r: c_double,
g: c_double,
b: c_double
) -> CppBox<QColor>
pub unsafe fn from_rgb_f_3a( 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().
sourcepub unsafe fn from_rgba(rgba: c_uint) -> CppBox<QColor>
pub unsafe fn from_rgba(rgba: c_uint) -> CppBox<QColor>
sourcepub unsafe fn from_rgba64_4a(
r: c_ushort,
g: c_ushort,
b: c_ushort,
a: c_ushort
) -> CppBox<QColor>
pub unsafe fn from_rgba64_4a( 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 = …)
.
sourcepub unsafe fn from_rgba64_1a(
rgba: impl CastInto<Ref<QRgba64>>
) -> CppBox<QColor>
pub unsafe fn from_rgba64_1a( rgba: impl CastInto<Ref<QRgba64>> ) -> CppBox<QColor>
sourcepub unsafe fn from_rgba64_3a(
r: c_ushort,
g: c_ushort,
b: c_ushort
) -> CppBox<QColor>
pub unsafe fn from_rgba64_3a( 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)
.
sourcepub 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
)
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 )
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.
sourcepub unsafe fn get_cmyk_4a_mut(
&self,
c: *mut c_int,
m: *mut c_int,
y: *mut c_int,
k: *mut c_int
)
pub unsafe fn get_cmyk_4a_mut( &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.
sourcepub 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
)
Available on cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.
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 )
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.
sourcepub unsafe fn get_cmyk_4a(
&self,
c: *mut c_int,
m: *mut c_int,
y: *mut c_int,
k: *mut c_int
)
Available on cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.
pub unsafe fn get_cmyk_4a( &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.
sourcepub 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
)
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 )
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.
sourcepub unsafe fn get_cmyk_f_4a_mut(
&self,
c: *mut c_double,
m: *mut c_double,
y: *mut c_double,
k: *mut c_double
)
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 )
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.
sourcepub 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
)
Available on cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.
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 )
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.
sourcepub unsafe fn get_cmyk_f_4a(
&self,
c: *mut c_double,
m: *mut c_double,
y: *mut c_double,
k: *mut c_double
)
Available on cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.
pub unsafe fn get_cmyk_f_4a( &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.
sourcepub unsafe fn get_hsl_4a(
&self,
h: *mut c_int,
s: *mut c_int,
l: *mut c_int,
a: *mut c_int
)
pub unsafe fn get_hsl_4a( &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().
sourcepub unsafe fn get_hsl_3a(&self, h: *mut c_int, s: *mut c_int, l: *mut c_int)
pub unsafe fn get_hsl_3a(&self, h: *mut c_int, s: *mut c_int, l: *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) 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().
sourcepub unsafe fn get_hsl_f_4a(
&self,
h: *mut c_double,
s: *mut c_double,
l: *mut c_double,
a: *mut c_double
)
pub unsafe fn get_hsl_f_4a( &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().
sourcepub unsafe fn get_hsl_f_3a(
&self,
h: *mut c_double,
s: *mut c_double,
l: *mut c_double
)
pub unsafe fn get_hsl_f_3a( &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().
sourcepub unsafe fn get_hsv_4a(
&self,
h: *mut c_int,
s: *mut c_int,
v: *mut c_int,
a: *mut c_int
)
pub unsafe fn get_hsv_4a( &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.
sourcepub unsafe fn get_hsv_3a(&self, h: *mut c_int, s: *mut c_int, v: *mut c_int)
pub unsafe fn get_hsv_3a(&self, h: *mut c_int, s: *mut c_int, v: *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) 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.
sourcepub unsafe fn get_hsv_f_4a(
&self,
h: *mut c_double,
s: *mut c_double,
v: *mut c_double,
a: *mut c_double
)
pub unsafe fn get_hsv_f_4a( &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.
sourcepub unsafe fn get_hsv_f_3a(
&self,
h: *mut c_double,
s: *mut c_double,
v: *mut c_double
)
pub unsafe fn get_hsv_f_3a( &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.
sourcepub unsafe fn get_rgb_4a(
&self,
r: *mut c_int,
g: *mut c_int,
b: *mut c_int,
a: *mut c_int
)
pub unsafe fn get_rgb_4a( &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
.
sourcepub unsafe fn get_rgb_3a(&self, r: *mut c_int, g: *mut c_int, b: *mut c_int)
pub unsafe fn get_rgb_3a(&self, r: *mut c_int, g: *mut c_int, b: *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) const
.
sourcepub unsafe fn get_rgb_f_4a(
&self,
r: *mut c_double,
g: *mut c_double,
b: *mut c_double,
a: *mut c_double
)
pub unsafe fn get_rgb_f_4a( &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
.
sourcepub unsafe fn get_rgb_f_3a(
&self,
r: *mut c_double,
g: *mut c_double,
b: *mut c_double
)
pub unsafe fn get_rgb_f_3a( &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
.
sourcepub unsafe fn green(&self) -> c_int
pub unsafe fn green(&self) -> c_int
Returns the green color component of this color.
Calls C++ function: int QColor::green() const
.
sourcepub unsafe fn green_f(&self) -> c_double
pub unsafe fn green_f(&self) -> c_double
Returns the green color component of this color.
Calls C++ function: double QColor::greenF() const
.
sourcepub unsafe fn hsl_hue(&self) -> c_int
pub unsafe fn hsl_hue(&self) -> c_int
Returns the hue color component of this color.
Calls C++ function: int QColor::hslHue() const
.
sourcepub unsafe fn hsl_hue_f(&self) -> c_double
pub unsafe fn hsl_hue_f(&self) -> c_double
Returns the hue color component of this color.
Calls C++ function: double QColor::hslHueF() const
.
sourcepub unsafe fn hsl_saturation(&self) -> c_int
pub unsafe fn hsl_saturation(&self) -> c_int
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.
sourcepub unsafe fn hsl_saturation_f(&self) -> c_double
pub unsafe fn hsl_saturation_f(&self) -> c_double
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().
sourcepub unsafe fn hsv_hue(&self) -> c_int
pub unsafe fn hsv_hue(&self) -> c_int
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.
sourcepub unsafe fn hsv_hue_f(&self) -> c_double
pub unsafe fn hsv_hue_f(&self) -> c_double
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.
sourcepub unsafe fn hsv_saturation(&self) -> c_int
pub unsafe fn hsv_saturation(&self) -> c_int
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.
sourcepub unsafe fn hsv_saturation_f(&self) -> c_double
pub unsafe fn hsv_saturation_f(&self) -> c_double
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.
sourcepub unsafe fn hue(&self) -> c_int
pub unsafe fn hue(&self) -> c_int
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.
sourcepub unsafe fn hue_f(&self) -> c_double
pub unsafe fn hue_f(&self) -> c_double
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.
sourcepub unsafe fn is_valid(&self) -> bool
pub unsafe fn is_valid(&self) -> bool
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
.
sourcepub unsafe fn is_valid_color_q_string(name: impl CastInto<Ref<QString>>) -> bool
pub unsafe fn is_valid_color_q_string(name: impl CastInto<Ref<QString>>) -> bool
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().
sourcepub unsafe fn is_valid_color_q_latin1_string(
arg1: impl CastInto<Ref<QLatin1String>>
) -> bool
pub unsafe fn is_valid_color_q_latin1_string( 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.
sourcepub unsafe fn is_valid_color_q_string_view(
arg1: impl CastInto<Ref<QStringView>>
) -> bool
Available on 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.
pub unsafe fn is_valid_color_q_string_view( 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.
sourcepub unsafe fn light_1a(&self, f: c_int) -> CppBox<QColor>
pub unsafe fn light_1a(&self, f: c_int) -> CppBox<QColor>
Use lighter(factor) instead.
Calls C++ function: QColor QColor::light(int f = …) const
.
Use lighter(factor) instead.
sourcepub unsafe fn light_0a(&self) -> CppBox<QColor>
pub unsafe fn light_0a(&self) -> CppBox<QColor>
Use lighter(factor) instead.
Calls C++ function: QColor QColor::light() const
.
Use lighter(factor) instead.
sourcepub unsafe fn lighter_1a(&self, f: c_int) -> CppBox<QColor>
pub unsafe fn lighter_1a(&self, f: c_int) -> CppBox<QColor>
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.
sourcepub unsafe fn lighter_0a(&self) -> CppBox<QColor>
pub unsafe fn lighter_0a(&self) -> CppBox<QColor>
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.
sourcepub unsafe fn lightness(&self) -> c_int
pub unsafe fn lightness(&self) -> c_int
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().
sourcepub unsafe fn lightness_f(&self) -> c_double
pub unsafe fn lightness_f(&self) -> c_double
Returns the lightness color component of this color.
Calls C++ function: double QColor::lightnessF() const
.
sourcepub unsafe fn magenta(&self) -> c_int
pub unsafe fn magenta(&self) -> c_int
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.
sourcepub unsafe fn magenta_f(&self) -> c_double
pub unsafe fn magenta_f(&self) -> c_double
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.
sourcepub unsafe fn name_0a(&self) -> CppBox<QString>
pub unsafe fn name_0a(&self) -> CppBox<QString>
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().
sourcepub unsafe fn name_1a(&self, format: NameFormat) -> CppBox<QString>
pub unsafe fn name_1a(&self, format: NameFormat) -> CppBox<QString>
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.
sourcepub unsafe fn new() -> CppBox<QColor>
pub unsafe fn new() -> CppBox<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.
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().
sourcepub unsafe fn from_global_color(color: GlobalColor) -> CppBox<QColor>
pub unsafe fn from_global_color(color: GlobalColor) -> CppBox<QColor>
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.
sourcepub unsafe fn from_4_int(
r: c_int,
g: c_int,
b: c_int,
a: c_int
) -> CppBox<QColor>
pub unsafe fn from_4_int( 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 = …)
.
sourcepub unsafe fn from_uint(rgb: c_uint) -> CppBox<QColor>
pub unsafe fn from_uint(rgb: c_uint) -> CppBox<QColor>
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)
.
sourcepub unsafe fn from_q_rgba64(
rgba64: impl CastInto<Ref<QRgba64>>
) -> CppBox<QColor>
pub unsafe fn from_q_rgba64( 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().
sourcepub unsafe fn from_q_string(name: impl CastInto<Ref<QString>>) -> CppBox<QColor>
pub unsafe fn from_q_string(name: impl CastInto<Ref<QString>>) -> CppBox<QColor>
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().
sourcepub unsafe fn from_char(aname: *const c_char) -> CppBox<QColor>
pub unsafe fn from_char(aname: *const c_char) -> CppBox<QColor>
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().
sourcepub unsafe fn from_q_latin1_string(
name: impl CastInto<Ref<QLatin1String>>
) -> CppBox<QColor>
pub unsafe fn from_q_latin1_string( 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().
sourcepub unsafe fn from_spec(spec: Spec) -> CppBox<QColor>
pub unsafe fn from_spec(spec: Spec) -> CppBox<QColor>
Calls C++ function: [constructor] void QColor::QColor(QColor::Spec spec)
.
sourcepub unsafe fn from_3_int(r: c_int, g: c_int, b: c_int) -> CppBox<QColor>
pub unsafe fn from_3_int(r: c_int, g: c_int, b: 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)
.
sourcepub unsafe fn from_q_string_view(
name: impl CastInto<Ref<QStringView>>
) -> CppBox<QColor>
Available on 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.
pub unsafe fn from_q_string_view( 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.
sourcepub unsafe fn from_spec5_ushort(
spec: Spec,
a1: c_ushort,
a2: c_ushort,
a3: c_ushort,
a4: c_ushort,
a5: c_ushort
) -> CppBox<QColor>
Available on cpp_lib_version="5.14.0"
only.
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>
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 = …)
.
sourcepub unsafe fn from_spec4_ushort(
spec: Spec,
a1: c_ushort,
a2: c_ushort,
a3: c_ushort,
a4: c_ushort
) -> CppBox<QColor>
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn from_spec4_ushort( 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)
.
sourcepub unsafe fn new_copy(color: impl CastInto<Ref<QColor>>) -> CppBox<QColor>
pub unsafe fn new_copy(color: impl CastInto<Ref<QColor>>) -> CppBox<QColor>
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().
sourcepub unsafe fn red(&self) -> c_int
pub unsafe fn red(&self) -> c_int
Returns the red color component of this color.
Calls C++ function: int QColor::red() const
.
sourcepub unsafe fn red_f(&self) -> c_double
pub unsafe fn red_f(&self) -> c_double
Returns the red color component of this color.
Calls C++ function: double QColor::redF() const
.
sourcepub unsafe fn rgb(&self) -> c_uint
pub unsafe fn rgb(&self) -> c_uint
Returns the RGB value of the color. The alpha value is opaque.
Calls C++ function: unsigned int QColor::rgb() const
.
sourcepub unsafe fn rgba(&self) -> c_uint
pub unsafe fn rgba(&self) -> c_uint
Returns the RGB value of the color, including its alpha.
Calls C++ function: unsigned int QColor::rgba() const
.
sourcepub unsafe fn rgba64(&self) -> CppBox<QRgba64>
pub unsafe fn rgba64(&self) -> CppBox<QRgba64>
Returns the RGB64 value of the color, including its alpha.
Calls C++ function: QRgba64 QColor::rgba64() const
.
sourcepub unsafe fn saturation(&self) -> c_int
pub unsafe fn saturation(&self) -> c_int
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.
sourcepub unsafe fn saturation_f(&self) -> c_double
pub unsafe fn saturation_f(&self) -> c_double
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.
sourcepub unsafe fn set_alpha(&self, alpha: c_int)
pub unsafe fn set_alpha(&self, alpha: c_int)
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.
sourcepub unsafe fn set_alpha_f(&self, alpha: c_double)
pub unsafe fn set_alpha_f(&self, alpha: c_double)
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.
sourcepub unsafe fn set_blue(&self, blue: c_int)
pub unsafe fn set_blue(&self, blue: c_int)
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)
.
sourcepub unsafe fn set_blue_f(&self, blue: c_double)
pub unsafe fn set_blue_f(&self, blue: c_double)
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)
.
sourcepub unsafe fn set_cmyk_5a(
&self,
c: c_int,
m: c_int,
y: c_int,
k: c_int,
a: c_int
)
pub unsafe fn set_cmyk_5a( &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.
sourcepub unsafe fn set_cmyk_4a(&self, c: c_int, m: c_int, y: c_int, k: c_int)
pub unsafe fn set_cmyk_4a(&self, c: c_int, m: c_int, y: c_int, k: 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)
.
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.
sourcepub unsafe fn set_cmyk_f_5a(
&self,
c: c_double,
m: c_double,
y: c_double,
k: c_double,
a: c_double
)
pub unsafe fn set_cmyk_f_5a( &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.
sourcepub unsafe fn set_cmyk_f_4a(
&self,
c: c_double,
m: c_double,
y: c_double,
k: c_double
)
pub unsafe fn set_cmyk_f_4a( &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.
sourcepub unsafe fn set_green(&self, green: c_int)
pub unsafe fn set_green(&self, green: c_int)
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)
.
sourcepub unsafe fn set_green_f(&self, green: c_double)
pub unsafe fn set_green_f(&self, green: c_double)
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)
.
sourcepub unsafe fn set_hsl_4a(&self, h: c_int, s: c_int, l: c_int, a: c_int)
pub unsafe fn set_hsl_4a(&self, h: c_int, s: c_int, l: c_int, a: c_int)
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.
sourcepub unsafe fn set_hsl_3a(&self, h: c_int, s: c_int, l: c_int)
pub unsafe fn set_hsl_3a(&self, h: c_int, s: c_int, l: c_int)
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.
sourcepub unsafe fn set_hsl_f_4a(
&self,
h: c_double,
s: c_double,
l: c_double,
a: c_double
)
pub unsafe fn set_hsl_f_4a( &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 = …)
.
sourcepub unsafe fn set_hsl_f_3a(&self, h: c_double, s: c_double, l: c_double)
pub unsafe fn set_hsl_f_3a(&self, h: c_double, s: c_double, l: 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)
.
sourcepub unsafe fn set_hsv_4a(&self, h: c_int, s: c_int, v: c_int, a: c_int)
pub unsafe fn set_hsv_4a(&self, h: c_int, s: c_int, v: c_int, a: c_int)
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.
sourcepub unsafe fn set_hsv_3a(&self, h: c_int, s: c_int, v: c_int)
pub unsafe fn set_hsv_3a(&self, h: c_int, s: c_int, v: c_int)
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.
sourcepub unsafe fn set_hsv_f_4a(
&self,
h: c_double,
s: c_double,
v: c_double,
a: c_double
)
pub unsafe fn set_hsv_f_4a( &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.
sourcepub unsafe fn set_hsv_f_3a(&self, h: c_double, s: c_double, v: c_double)
pub unsafe fn set_hsv_f_3a(&self, h: c_double, s: c_double, v: 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)
.
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.
sourcepub unsafe fn set_named_color_q_string(&self, name: impl CastInto<Ref<QString>>)
pub unsafe fn set_named_color_q_string(&self, name: impl CastInto<Ref<QString>>)
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.
sourcepub unsafe fn set_named_color_q_latin1_string(
&self,
name: impl CastInto<Ref<QLatin1String>>
)
pub unsafe fn set_named_color_q_latin1_string( &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.
sourcepub unsafe fn set_named_color_q_string_view(
&self,
name: impl CastInto<Ref<QStringView>>
)
Available on 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.
pub unsafe fn set_named_color_q_string_view( &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.
sourcepub unsafe fn set_red(&self, red: c_int)
pub unsafe fn set_red(&self, red: c_int)
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)
.
sourcepub unsafe fn set_red_f(&self, red: c_double)
pub unsafe fn set_red_f(&self, red: c_double)
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)
.
sourcepub unsafe fn set_rgb_4a(&self, r: c_int, g: c_int, b: c_int, a: c_int)
pub unsafe fn set_rgb_4a(&self, r: c_int, g: c_int, b: c_int, a: c_int)
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 = …)
.
sourcepub unsafe fn set_rgb_1a(&self, rgb: c_uint)
pub unsafe fn set_rgb_1a(&self, rgb: c_uint)
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.
sourcepub unsafe fn set_rgb_3a(&self, r: c_int, g: c_int, b: c_int)
pub unsafe fn set_rgb_3a(&self, r: c_int, g: c_int, b: c_int)
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)
.
sourcepub unsafe fn set_rgb_f_4a(
&self,
r: c_double,
g: c_double,
b: c_double,
a: c_double
)
pub unsafe fn set_rgb_f_4a( &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 = …)
.
sourcepub unsafe fn set_rgb_f_3a(&self, r: c_double, g: c_double, b: c_double)
pub unsafe fn set_rgb_f_3a(&self, r: c_double, g: c_double, b: 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)
.
sourcepub unsafe fn set_rgba(&self, rgba: c_uint)
pub unsafe fn set_rgba(&self, rgba: c_uint)
Sets the RGB value to rgba, including its alpha.
Calls C++ function: void QColor::setRgba(unsigned int rgba)
.
sourcepub unsafe fn set_rgba64(&self, rgba: impl CastInto<Ref<QRgba64>>)
pub unsafe fn set_rgba64(&self, rgba: impl CastInto<Ref<QRgba64>>)
Sets the RGB64 value to rgba, including its alpha.
Calls C++ function: void QColor::setRgba64(QRgba64 rgba)
.
sourcepub unsafe fn spec(&self) -> Spec
pub unsafe fn spec(&self) -> Spec
Returns how the color was specified.
Calls C++ function: QColor::Spec QColor::spec() const
.
sourcepub unsafe fn to_cmyk(&self) -> CppBox<QColor>
pub unsafe fn to_cmyk(&self) -> CppBox<QColor>
sourcepub unsafe fn to_extended_rgb(&self) -> CppBox<QColor>
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn to_extended_rgb(&self) -> CppBox<QColor>
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
.
sourcepub unsafe fn to_hsv(&self) -> CppBox<QColor>
pub unsafe fn to_hsv(&self) -> CppBox<QColor>
sourcepub unsafe fn to_q_variant(&self) -> CppBox<QVariant>
pub unsafe fn to_q_variant(&self) -> CppBox<QVariant>
sourcepub unsafe fn value(&self) -> c_int
pub unsafe fn value(&self) -> c_int
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.
sourcepub unsafe fn value_f(&self) -> c_double
pub unsafe fn value_f(&self) -> c_double
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.
sourcepub unsafe fn yellow(&self) -> c_int
pub unsafe fn yellow(&self) -> c_int
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.
Trait Implementations§
source§impl CppDeletable for QColor
impl CppDeletable for QColor
source§unsafe fn delete(&self)
unsafe fn delete(&self)
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.
source§impl PartialEq<Ref<QColor>> for QColor
impl PartialEq<Ref<QColor>> for QColor
source§fn eq(&self, c: &Ref<QColor>) -> bool
fn eq(&self, c: &Ref<QColor>) -> bool
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
.