Struct qt_gui::q_palette::ColorRole

source ·
pub struct ColorRole(/* private fields */);
Expand description

Color Roles

C++ enum: QPalette::ColorRole.

C++ documentation:

Color Roles

The ColorRole enum defines the different symbolic color roles used in current GUIs.

The central roles are:

There are some color roles used mostly for 3D bevel and shadow effects. All of these are normally derived from Window, and used in ways that depend on that relationship. For example, buttons depend on it to make the bevels look attractive, and Motif scroll bars depend on Mid to be slightly different from Window.

Selected (marked) items have two roles:

There are two color roles related to hyperlinks:

Note that we do not use the Link and LinkVisited roles when rendering rich text in Qt, and that we recommend that you use CSS and the QTextDocument::setDefaultStyleSheet() function to alter the appearance of links. For example:

QTextBrowser browser; QColor linkColor(Qt::red); QString sheet = QString::fromLatin1(“a { text-decoration: underline; color: %1 }”).arg(linkColor.name()); browser.document()->setDefaultStyleSheet(sheet);

Implementations§

source§

impl ColorRole

source

pub fn to_int(&self) -> c_int

source§

impl ColorRole

source

pub const WindowText: ColorRole = _

A general foreground color. (C++ enum variant: WindowText = 0)

source

pub const Button: ColorRole = _

The general button background color. This background can be different from Window as some styles require a different background color for buttons. (C++ enum variant: Button = 1)

source

pub const Light: ColorRole = _

Lighter than Button color. (C++ enum variant: Light = 2)

source

pub const Midlight: ColorRole = _

Between Button and Light. (C++ enum variant: Midlight = 3)

source

pub const Dark: ColorRole = _

Darker than Button. (C++ enum variant: Dark = 4)

source

pub const Mid: ColorRole = _

Between Button and Dark. (C++ enum variant: Mid = 5)

source

pub const Text: ColorRole = _

The foreground color used with Base. This is usually the same as the WindowText, in which case it must provide good contrast with Window and Base. (C++ enum variant: Text = 6)

source

pub const BrightText: ColorRole = _

A text color that is very different from WindowText, and contrasts well with e.g. Dark. Typically used for text that needs to be drawn where Text or WindowText would give poor contrast, such as on pressed push buttons. Note that text colors can be used for things other than just words; text colors are usually used for text, but it’s quite common to use the text color roles for lines, icons, etc. (C++ enum variant: BrightText = 7)

source

pub const ButtonText: ColorRole = _

A foreground color used with the Button color. (C++ enum variant: ButtonText = 8)

source

pub const Base: ColorRole = _

Used mostly as the background color for text entry widgets, but can also be used for other painting - such as the background of combobox drop down lists and toolbar handles. It is usually white or another light color. (C++ enum variant: Base = 9)

source

pub const Window: ColorRole = _

A general background color. (C++ enum variant: Window = 10)

source

pub const Shadow: ColorRole = _

A very dark color. By default, the shadow color is Qt::black. (C++ enum variant: Shadow = 11)

source

pub const Highlight: ColorRole = _

A color to indicate a selected item or the current item. By default, the highlight color is Qt::darkBlue. (C++ enum variant: Highlight = 12)

source

pub const HighlightedText: ColorRole = _

A text color that contrasts with Highlight. By default, the highlighted text color is Qt::white. (C++ enum variant: HighlightedText = 13)

A text color used for unvisited hyperlinks. By default, the link color is Qt::blue. (C++ enum variant: Link = 14)

source

pub const LinkVisited: ColorRole = _

A text color used for already visited hyperlinks. By default, the linkvisited color is Qt::magenta. (C++ enum variant: LinkVisited = 15)

source

pub const AlternateBase: ColorRole = _

Used as the alternate background color in views with alternating row colors (see QAbstractItemView::setAlternatingRowColors()). (C++ enum variant: AlternateBase = 16)

source

pub const NoRole: ColorRole = _

No role; this special role is often used to indicate that a role has not been assigned. (C++ enum variant: NoRole = 17)

source

pub const ToolTipBase: ColorRole = _

Used as the background color for QToolTip and QWhatsThis. Tool tips use the Inactive color group of QPalette, because tool tips are not active windows. (C++ enum variant: ToolTipBase = 18)

source

pub const ToolTipText: ColorRole = _

Used as the foreground color for QToolTip and QWhatsThis. Tool tips use the Inactive color group of QPalette, because tool tips are not active windows. (C++ enum variant: ToolTipText = 19)

source

pub const NColorRoles: ColorRole = _

C++ enum variant: NColorRoles = 20

source

pub const Foreground: ColorRole = _

This value is obsolete. Use WindowText instead. (C++ enum variant: Foreground = 0)

source

pub const Background: ColorRole = _

This value is obsolete. Use Window instead. (C++ enum variant: Background = 10)

source

pub const PlaceholderText: ColorRole = _

Used as the placeholder color for various text input widgets. This enum value has been introduced in Qt 5.12 (C++ enum variant: PlaceholderText = 20)

source

pub const NColorRoles2: ColorRole = _

C++ enum variant: NColorRoles = 21

Trait Implementations§

source§

impl Clone for ColorRole

source§

fn clone(&self) -> ColorRole

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 ColorRole

source§

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

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

impl From<ColorRole> for c_int

source§

fn from(value: ColorRole) -> Self

Converts to this type from the input type.
source§

impl From<i32> for ColorRole

source§

fn from(value: c_int) -> Self

Converts to this type from the input type.
source§

impl PartialEq for ColorRole

source§

fn eq(&self, other: &ColorRole) -> 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 Copy for ColorRole

source§

impl Eq for ColorRole

source§

impl StructuralEq for ColorRole

source§

impl StructuralPartialEq for ColorRole

Auto Trait Implementations§

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, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. 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> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
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, 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.