pub struct ColorRole(/* private fields */);
Expand description
C++ enum: QPalette::ColorRole
.
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
impl ColorRole
sourcepub const WindowText: ColorRole = _
pub const WindowText: ColorRole = _
A general foreground color. (C++ enum variant: WindowText = 0
)
sourcepub const Button: ColorRole = _
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
)
sourcepub const Text: ColorRole = _
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
)
sourcepub const BrightText: ColorRole = _
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
)
sourcepub const ButtonText: ColorRole = _
pub const ButtonText: ColorRole = _
A foreground color used with the Button
color. (C++ enum variant: ButtonText = 8
)
sourcepub const Base: ColorRole = _
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
)
sourcepub const Shadow: ColorRole = _
pub const Shadow: ColorRole = _
A very dark color. By default, the shadow color is Qt::black. (C++ enum variant: Shadow = 11
)
sourcepub const Highlight: ColorRole = _
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
)
sourcepub const HighlightedText: ColorRole = _
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
)
sourcepub const Link: ColorRole = _
pub const Link: ColorRole = _
A text color used for unvisited hyperlinks. By default, the link color is Qt::blue. (C++ enum variant: Link = 14
)
sourcepub const LinkVisited: ColorRole = _
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
)
sourcepub const AlternateBase: ColorRole = _
pub const AlternateBase: ColorRole = _
Used as the alternate background color in views with alternating row colors (see QAbstractItemView::setAlternatingRowColors()). (C++ enum variant: AlternateBase = 16
)
sourcepub const NoRole: ColorRole = _
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
)
sourcepub const ToolTipBase: ColorRole = _
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
)
sourcepub const ToolTipText: ColorRole = _
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
)
sourcepub const NColorRoles: ColorRole = _
pub const NColorRoles: ColorRole = _
C++ enum variant: NColorRoles = 20
sourcepub const Foreground: ColorRole = _
pub const Foreground: ColorRole = _
This value is obsolete. Use WindowText instead. (C++ enum variant: Foreground = 0
)
sourcepub const Background: ColorRole = _
pub const Background: ColorRole = _
This value is obsolete. Use Window instead. (C++ enum variant: Background = 10
)
sourcepub const PlaceholderText: ColorRole = _
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
)
sourcepub const NColorRoles2: ColorRole = _
pub const NColorRoles2: ColorRole = _
C++ enum variant: NColorRoles = 21