|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Objectjava.lang.Enum<QPalette.ColorRole>
com.trolltech.qt.gui.QPalette.ColorRole
public static enum QPalette.ColorRole
The ColorRole enum defines the different symbolic color roles used in current GUIs.
The central roles are:
Constant | Value | Description |
---|---|---|
Window | 10 | A general background color. |
Background | 10 | This value is obsolete. Use Window instead. |
WindowText | 0 | A general foreground color. |
Foreground | 0 | This value is obsolete. Use WindowText instead. |
Base | 9 | 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. |
AlternateBase | 16 | Used as the alternate background color in views with alternating row colors (see QAbstractItemView::setAlternatingRowColors()). |
Text | 6 | 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. |
Button | 1 | The general button background color. This background can be different from Window as some styles require a different background color for buttons. |
ButtonText | 8 | A foreground color used with the Button color. |
BrightText | 7 | 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. |
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.
Constant | Value | Description |
---|---|---|
Light | 2 | Lighter than Button color. |
Midlight | 3 | Between Button and Light. |
Dark | 4 | Darker than Button. |
Mid | 5 | Between Button and Dark. |
Shadow | 11 | A very dark color. By default, the shadow color is Qt::black. |
Selected (marked) items have two roles:
Constant | Value | Description |
---|---|---|
Highlight | 12 | A color to indicate a selected item or the current item. By default, the highlight color is Qt::darkBlue. |
HighlightedText | 13 | A text color that contrasts with Highlight. By default, the highlighted text color is Qt::white. |
There are two color roles related to hyperlinks:
Constant | Value | Description |
---|---|---|
Link | 14 | A text color used for unvisited hyperlinks. By default, the link color is Qt::blue. |
LinkVisited | 15 | A text color used for already visited hyperlinks. By default, the linkvisited color is Qt::magenta. |
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);
Enum Constant Summary | |
---|---|
AlternateBase
Used as the alternate background color in views with alternating row colors (see QAbstractItemView::setAlternatingRowColors()). |
|
Base
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. |
|
BrightText
A text color that is very different from WindowText, and contrasts well with e.g. Dark. |
|
Button
The general button background color. |
|
ButtonText
A foreground color used with the Button color. |
|
Dark
Darker than Button. |
|
Highlight
A color to indicate a selected item or the current item. |
|
HighlightedText
A text color that contrasts with Highlight. |
|
Light
Lighter than Button color. |
|
Link
A text color used for unvisited hyperlinks. |
|
LinkVisited
A text color used for already visited hyperlinks. |
|
Mid
Between Button and Dark. |
|
Midlight
Between Button and Light. |
|
NoRole
Internal. |
|
Shadow
A very dark color. |
|
Text
The foreground color used with Base. |
|
Window
A general background color. |
|
WindowText
A general foreground color. |
Method Summary | |
---|---|
static QPalette.ColorRole |
resolve(int value)
|
int |
value()
This function should return an integer value for the enum values of the enumeration that implements this interface. |
static QPalette.ColorRole |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. |
static QPalette.ColorRole[] |
values()
Returns an array containing the constants of this enum type, in the order they're declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final QPalette.ColorRole WindowText
A general foreground color.
public static final QPalette.ColorRole Button
The general button background color. This background can be different from Window as some styles require a different background color for buttons.
public static final QPalette.ColorRole Light
Lighter than Button color.
public static final QPalette.ColorRole Midlight
Between Button and Light.
public static final QPalette.ColorRole Dark
Darker than Button.
public static final QPalette.ColorRole Mid
Between Button and Dark.
public static final QPalette.ColorRole Text
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.
public static final QPalette.ColorRole BrightText
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.
public static final QPalette.ColorRole ButtonText
A foreground color used with the Button color.
public static final QPalette.ColorRole Base
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.
public static final QPalette.ColorRole Window
A general background color.
public static final QPalette.ColorRole Shadow
A very dark color. By default, the shadow color is Qt::black.
public static final QPalette.ColorRole Highlight
A color to indicate a selected item or the current item. By default, the highlight color is Qt::darkBlue.
public static final QPalette.ColorRole HighlightedText
A text color that contrasts with Highlight. By default, the highlighted text color is Qt::white.
public static final QPalette.ColorRole Link
A text color used for unvisited hyperlinks. By default, the link color is Qt::blue.
public static final QPalette.ColorRole LinkVisited
A text color used for already visited hyperlinks. By default, the linkvisited color is Qt::magenta.
public static final QPalette.ColorRole AlternateBase
Used as the alternate background color in views with alternating row colors (see QAbstractItemView::setAlternatingRowColors()).
public static final QPalette.ColorRole NoRole
Method Detail |
---|
public static final QPalette.ColorRole[] values()
for(QPalette.ColorRole c : QPalette.ColorRole.values()) System.out.println(c);
public static QPalette.ColorRole valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.
java.lang.IllegalArgumentException
- if this enum type has no constant
with the specified namepublic int value()
QtEnumerator
value
in interface QtEnumerator
public static QPalette.ColorRole resolve(int value)
|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |