Qt Jambi Home

com.trolltech.qt.gui
Enum QPalette.ColorRole

java.lang.Object
  extended by java.lang.Enum<QPalette.ColorRole>
      extended by com.trolltech.qt.gui.QPalette.ColorRole
All Implemented Interfaces:
QtEnumerator, java.io.Serializable, java.lang.Comparable<QPalette.ColorRole>
Enclosing class:
QPalette

public static enum QPalette.ColorRole
extends java.lang.Enum<QPalette.ColorRole>
implements QtEnumerator

Color Roles

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

The central roles are:

ConstantValueDescription
Window10A general background color.
Background10This value is obsolete. Use Window instead.
WindowText0A general foreground color.
Foreground0This value is obsolete. Use WindowText instead.
Base9Used 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.
AlternateBase16Used as the alternate background color in views with alternating row colors (see QAbstractItemView::setAlternatingRowColors()).
Text6The 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.
Button1The general button background color. This background can be different from Window as some styles require a different background color for buttons.
ButtonText8A foreground color used with the Button color.
BrightText7A 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.

ConstantValueDescription
Light2Lighter than Button color.
Midlight3Between Button and Light.
Dark4Darker than Button.
Mid5Between Button and Dark.
Shadow11A very dark color. By default, the shadow color is Qt::black.

Selected (marked) items have two roles:

ConstantValueDescription
Highlight12A color to indicate a selected item or the current item. By default, the highlight color is Qt::darkBlue.
HighlightedText13A text color that contrasts with Highlight. By default, the highlighted text color is Qt::white.

There are two color roles related to hyperlinks:

ConstantValueDescription
Link14A text color used for unvisited hyperlinks. By default, the link color is Qt::blue.
LinkVisited15A 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

WindowText

public static final QPalette.ColorRole WindowText

A general foreground color.


Button

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.


Light

public static final QPalette.ColorRole Light

Lighter than Button color.


Midlight

public static final QPalette.ColorRole Midlight

Between Button and Light.


Dark

public static final QPalette.ColorRole Dark

Darker than Button.


Mid

public static final QPalette.ColorRole Mid

Between Button and Dark.


Text

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.


BrightText

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.


ButtonText

public static final QPalette.ColorRole ButtonText

A foreground color used with the Button color.


Base

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.


Window

public static final QPalette.ColorRole Window

A general background color.


Shadow

public static final QPalette.ColorRole Shadow

A very dark color. By default, the shadow color is Qt::black.


Highlight

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.


HighlightedText

public static final QPalette.ColorRole HighlightedText

A text color that contrasts with Highlight. By default, the highlighted text color is Qt::white.


Link

public static final QPalette.ColorRole Link

A text color used for unvisited hyperlinks. By default, the link color is Qt::blue.


LinkVisited

public static final QPalette.ColorRole LinkVisited

A text color used for already visited hyperlinks. By default, the linkvisited color is Qt::magenta.


AlternateBase

public static final QPalette.ColorRole AlternateBase

Used as the alternate background color in views with alternating row colors (see QAbstractItemView::setAlternatingRowColors()).


NoRole

public static final QPalette.ColorRole NoRole
Internal.

Method Detail

values

public static final QPalette.ColorRole[] values()
Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:
for(QPalette.ColorRole c : QPalette.ColorRole.values())
        System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static QPalette.ColorRole valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name

value

public int value()
Description copied from interface: QtEnumerator
This function should return an integer value for the enum values of the enumeration that implements this interface.

Specified by:
value in interface QtEnumerator

resolve

public static QPalette.ColorRole resolve(int value)

Qt Jambi Home