Struct cxx_qt_lib::QColor

source ·
#[repr(C)]
pub struct QColor { /* private fields */ }
Expand description

The QColor class provides colors based on RGB, HSL, HSV or CMYK values.

Implementations§

source§

impl QColor

source

pub fn alpha(&self) -> i32

Returns the alpha color component of this color.

source§

impl QColor

source

pub fn black(&self) -> i32

Returns the black color component of this color.

source§

impl QColor

source

pub fn blue(&self) -> i32

Returns the blue color component of this color.

source§

impl QColor

source

pub fn convert_to(&self, spec: QColorSpec) -> QColor

Creates a copy of this color in the format specified by colorSpec.

source§

impl QColor

source

pub fn cyan(&self) -> i32

Returns the cyan color component of this color.

source§

impl QColor

source

pub fn darker(&self, factor: i32) -> QColor

Returns a darker (or lighter) color, but does not change this object.

source§

impl QColor

source

pub fn green(&self) -> i32

Returns the green color component of this color.

source§

impl QColor

source

pub fn hsl_hue(&self) -> i32

Returns the HSL hue color component of this color.

source§

impl QColor

source

pub fn hsl_saturation(&self) -> i32

Returns the HSL saturation color component of this color.

source§

impl QColor

source

pub fn hsv_hue(&self) -> i32

Returns the HSV hue color component of this color.

source§

impl QColor

source

pub fn hsv_saturation(&self) -> i32

Returns the HSV saturation color component of this color.

source§

impl QColor

source

pub fn hue(&self) -> i32

Returns the HSV hue color component of this color.

The color is implicitly converted to HSV.

source§

impl QColor

source

pub fn is_valid(&self) -> bool

Returns true if the color is valid; otherwise returns false.

source§

impl QColor

source

pub fn lighter(&self, factor: i32) -> QColor

Returns a lighter (or darker) color, but does not change this object.

source§

impl QColor

source

pub fn lightness(&self) -> i32

Returns the lightness color component of this color.

source§

impl QColor

source

pub fn magenta(&self) -> i32

Returns the magenta color component of this color.

source§

impl QColor

source

pub fn name(&self, format: QColorNameFormat) -> QString

Returns the name of the color in the specified format.

source§

impl QColor

source

pub fn red(&self) -> i32

Returns the red color component of this color.

source§

impl QColor

source

pub fn saturation(&self) -> i32

Returns the HSV saturation color component of this color.

The color is implicitly converted to HSV.

source§

impl QColor

source

pub fn set_alpha(&mut self, alpha: i32)

Sets the alpha of this color to alpha. Integer alpha is specified in the range 0-255.

source§

impl QColor

source

pub fn set_blue(&mut self, blue: i32)

Sets the blue color component of this color to blue. Integer components are specified in the range 0-255.

source§

impl QColor

source

pub fn set_cmyk(&mut self, c: i32, m: i32, y: i32, k: i32, a: i32)

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.

source§

impl QColor

source

pub fn set_green(&mut self, green: i32)

Sets the green color component of this color to green. Integer components are specified in the range 0-255.

source§

impl QColor

source

pub fn set_hsl(&mut self, h: i32, s: i32, l: i32, a: i32)

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.

source§

impl QColor

source

pub fn set_hsv(&mut self, h: i32, s: i32, v: i32, a: i32)

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.

source§

impl QColor

source

pub fn set_red(&mut self, red: i32)

Sets the red color component of this color to red. Integer components are specified in the range 0-255.

source§

impl QColor

source

pub fn set_rgb(&mut self, r: i32, g: i32, b: i32, a: i32)

Sets the RGB value to r, g, b and the alpha value to a.

All the values must be in the range 0-255.

source§

impl QColor

source

pub fn spec(&self) -> QColorSpec

Returns how the color was specified.

source§

impl QColor

source

pub fn to_cmyk(&self) -> QColor

Creates and returns a CMYK QColor based on this color.

source§

impl QColor

source

pub fn to_extended_rgb(&self) -> QColor

Create and returns an extended RGB QColor based on this color.

source§

impl QColor

source

pub fn to_hsl(&self) -> QColor

Creates and returns an HSL QColor based on this color.

source§

impl QColor

source

pub fn to_hsv(&self) -> QColor

Creates and returns an HSV QColor based on this color.

source§

impl QColor

source

pub fn to_rgb(&self) -> QColor

Create and returns an RGB QColor based on this color.

source§

impl QColor

source

pub fn value(&self) -> i32

Returns the value color component of this color.

source§

impl QColor

source

pub fn yellow(&self) -> i32

Returns the yellow color component of this color.

source§

impl QColor

source

pub fn alpha_f(&self) -> f32

Returns the alpha color component of this color.

source

pub fn black_f(&self) -> f32

Returns the black color component of this color.

source

pub fn blue_f(&self) -> f32

Returns the blue color component of this color.

source

pub fn color_names() -> QStringList

Returns a QStringList containing the color names Qt knows about.

source

pub fn cyan_f(&self) -> f32

Returns the cyan color component of this color.

source

pub fn from_cmyk(c: i32, m: i32, y: i32, k: i32) -> Self

Constructs a QColor from the CMYK value c, m, y, and k.

source

pub fn from_cmyka(c: i32, m: i32, y: i32, k: i32, a: i32) -> Self

Constructs a QColor from the CMYK value c, m, y, k, and the alpha-channel (transparency) value of a.

source

pub fn from_cmyk_f(c: f32, m: f32, y: f32, k: f32) -> Self

Constructs a QColor from the CMYK value c, m, y, and k.

source

pub fn from_cmyka_f(c: f32, m: f32, y: f32, k: f32, a: f32) -> Self

Constructs a QColor from the CMYK value c, m, y, k, and the alpha-channel (transparency) value of a.

source

pub fn from_hsl(h: i32, s: i32, l: i32) -> Self

Constructs a QColor from the HSL value h, s, and l.

source

pub fn from_hsla(h: i32, s: i32, l: i32, a: i32) -> Self

Constructs a QColor from the HSL value h, s, l, and the alpha-channel (transparency) value of a.

source

pub fn from_hsl_f(h: f32, s: f32, l: f32) -> Self

Constructs a QColor from the HSL value h, s, and l.

source

pub fn from_hsla_f(h: f32, s: f32, l: f32, a: f32) -> Self

Constructs a QColor from the HSL value h, s, l, and the alpha-channel (transparency) value of a.

source

pub fn from_hsv(h: i32, s: i32, v: i32) -> Self

Constructs a QColor from the HSV value h, s, and v.

source

pub fn from_hsva(h: i32, s: i32, v: i32, a: i32) -> Self

Constructs a QColor from the HSV value h, s, v, and the alpha-channel (transparency) value of a.

source

pub fn from_hsv_f(h: f32, s: f32, v: f32) -> Self

Constructs a QColor from the HSV value h, s, and v.

source

pub fn from_hsva_f(h: f32, s: f32, v: f32, a: f32) -> Self

Constructs a QColor from the HSV value h, s, v, and the alpha-channel (transparency) value of a.

source

pub fn from_rgb(red: i32, green: i32, blue: i32) -> Self

Constructs a QColor with the RGB value r, g, and b.

The color is left invalid if any of the arguments are invalid.

source

pub fn from_rgba(red: i32, green: i32, blue: i32, alpha: i32) -> Self

Constructs a QColor with the RGB value r, g, b, and the alpha-channel (transparency) value of a.

The color is left invalid if any of the arguments are invalid.

source

pub fn from_rgb_f(red: f32, green: f32, blue: f32) -> Self

Constructs a QColor with the RGB value r, g, and b.

source

pub fn from_rgba_f(red: f32, green: f32, blue: f32, alpha: f32) -> Self

Constructs a QColor with the RGB value r, g, b, and the alpha-channel (transparency) value of a.

source

pub fn green_f(&self) -> f32

Returns the green color component of this color.

source

pub fn hsl_hue_f(&self) -> f32

Returns the HSL hue color component of this color.

source

pub fn hsl_saturation_f(&self) -> f32

Returns the HSL saturation color component of this color.

source

pub fn hsv_hue_f(&self) -> f32

Returns the hue color component of this color.

source

pub fn hsv_saturation_f(&self) -> f32

Returns the HSV saturation color component of this color.

source

pub fn hue_f(self: &QColor) -> f32

Returns the HSV hue color component of this color.

The color is implicitly converted to HSV.

source

pub fn lightness_f(&self) -> f32

Returns the lightness color component of this color.

source

pub fn magenta_f(&self) -> f32

Returns the magenta color component of this color.

source

pub fn red_f(&self) -> f32

Returns the red color component of this color.

source

pub fn saturation_f(&self) -> f32

Returns the HSV saturation color component of this color.

The color is implicitly converted to HSV.

source

pub fn set_alpha_f(&mut self, alpha: f32)

Sets the alpha of this color to alpha. float alpha is specified in the range 0.0-1.0.

source

pub fn set_blue_f(&mut self, blue: f32)

Sets the blue color component of this color to blue.

If blue lies outside the 0.0-1.0 range, the color model will be changed to ExtendedRgb.

source

pub fn set_cmyk_f(&mut self, c: f32, m: f32, y: f32, k: f32, a: f32)

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.

source

pub fn set_green_f(&mut self, green: f32)

Sets the green color component of this color to green.

If green lies outside the 0.0-1.0 range, the color model will be changed to ExtendedRgb.

source

pub fn set_hsl_f(&mut self, h: f32, s: f32, l: f32, a: f32)

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.

All the values must be in the range 0.0-1.0.

source

pub fn set_hsv_f(&mut self, h: f32, s: f32, v: f32, a: f32)

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.

source

pub fn set_red_f(&mut self, red: f32)

Sets the red color component of this color to red.

If red lies outside the 0.0-1.0 range, the color model will be changed to ExtendedRgb.

source

pub fn set_rgb_f(&mut self, r: f32, g: f32, b: f32, a: f32)

Sets the color channels of this color to r (red), g (green), b (blue) and a (alpha, transparency).

The alpha value must be in the range 0.0-1.0. If any of the other values are outside the range of 0.0-1.0 the color model will be set as ExtendedRgb.

source

pub fn value_f(self: &QColor) -> f32

Returns the value color component of this color.

source

pub fn yellow_f(self: &QColor) -> f32

Returns the yellow color component of this color.

Trait Implementations§

source§

impl Clone for QColor

source§

fn clone(&self) -> QColor

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for QColor

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for QColor

source§

fn default() -> Self

Constructs an invalid color. 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.

source§

impl Display for QColor

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl ExternType for QColor

§

type Id = (Q, C, o, l, o, r)

A type-level representation of the type’s C++ namespace and type name. Read more
§

type Kind = Trivial

source§

impl PartialEq for QColor

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl QListElement for QColor

§

type TypeId = (Q, L, i, s, t, __, Q, C, o, l, o, r)

source§

fn append(list: &mut QList<Self>, value: Self)

source§

fn append_clone(list: &mut QList<Self>, value: &Self)

source§

fn clear(list: &mut QList<Self>)

source§

fn clone(list: &QList<Self>) -> QList<Self>

source§

fn contains(list: &QList<Self>, value: &Self) -> bool

source§

fn default() -> QList<Self>

source§

fn drop(list: &mut QList<Self>)

source§

unsafe fn get_unchecked(list: &QList<Self>, pos: isize) -> &Self

Safety Read more
source§

fn index_of(list: &QList<Self>, value: &Self) -> isize

source§

fn insert(list: &mut QList<Self>, pos: isize, value: Self)

source§

fn insert_clone(list: &mut QList<Self>, pos: isize, value: &Self)

source§

fn len(list: &QList<Self>) -> isize

source§

fn remove(list: &mut QList<Self>, pos: isize)

source§

fn reserve(list: &mut QList<Self>, size: isize)

source§

impl QVariantValue for QColor

source§

impl QVectorElement for QColor

§

type TypeId = (Q, V, e, c, t, o, r, __, Q, C, o, l, o, r)

source§

fn append(vector: &mut QVector<Self>, value: Self)

source§

fn append_clone(vector: &mut QVector<Self>, value: &Self)

source§

fn clear(vector: &mut QVector<Self>)

source§

fn clone(vector: &QVector<Self>) -> QVector<Self>

source§

fn contains(vector: &QVector<Self>, value: &Self) -> bool

source§

fn default() -> QVector<Self>

source§

fn drop(vector: &mut QVector<Self>)

source§

unsafe fn get_unchecked(vector: &QVector<Self>, pos: isize) -> &Self

Safety Read more
source§

fn index_of(vector: &QVector<Self>, value: &Self) -> isize

source§

fn insert(vector: &mut QVector<Self>, pos: isize, value: Self)

source§

fn insert_clone(vector: &mut QVector<Self>, pos: isize, value: &Self)

source§

fn len(vector: &QVector<Self>) -> isize

source§

fn remove(vector: &mut QVector<Self>, pos: isize)

source§

fn reserve(vector: &mut QVector<Self>, size: isize)

source§

impl TryFrom<&QString> for QColor

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_from(value: &QString) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&String> for QColor

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_from(value: &String) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&str> for QColor

§

type Error = &'static str

The type returned in the event of a conversion error.
source§

fn try_from(value: &str) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for QColor

Auto Trait Implementations§

§

impl Freeze for QColor

§

impl RefUnwindSafe for QColor

§

impl Send for QColor

§

impl Sync for QColor

§

impl Unpin for QColor

§

impl UnwindSafe for QColor

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.