Qt 4.8
|
The QPalette class contains color groups for each widget state. More...
#include <qpalette.h>
Public Types | |
enum | ColorGroup { Active, Disabled, Inactive, NColorGroups, Current, All, Normal = Active } |
enum | ColorRole { WindowText, Button, Light, Midlight, Dark, Mid, Text, BrightText, ButtonText, Base, Window, Shadow, Highlight, HighlightedText, Link, LinkVisited, AlternateBase, NoRole, ToolTipBase, ToolTipText, NColorRoles = ToolTipText + 1, Foreground = WindowText, Background = Window } |
The ColorRole enum defines the different symbolic color roles used in current GUIs. More... | |
Public Functions | |
const QBrush & | alternateBase () const |
Returns the alternate base brush of the current color group. More... | |
const QBrush & | background () const |
Use window() instead. More... | |
const QBrush & | base () const |
Returns the base brush of the current color group. More... | |
const QBrush & | brightText () const |
Returns the bright text foreground brush of the current color group. More... | |
const QBrush & | brush (ColorGroup cg, ColorRole cr) const |
Returns the brush in the specified color group, used for the given color role. More... | |
const QBrush & | brush (ColorRole cr) const |
Returns the brush that has been set for the given color role in the current ColorGroup. More... | |
const QBrush & | button () const |
Returns the button brush of the current color group. More... | |
const QBrush & | buttonText () const |
Returns the button text foreground brush of the current color group. More... | |
qint64 | cacheKey () const |
Returns a number that identifies the contents of this QPalette object. More... | |
const QColor & | color (ColorGroup cg, ColorRole cr) const |
Returns the color in the specified color group, used for the given color role. More... | |
const QColor & | color (ColorRole cr) const |
Returns the color that has been set for the given color role in the current ColorGroup. More... | |
ColorGroup | currentColorGroup () const |
Returns the palette's current color group. More... | |
const QBrush & | dark () const |
Returns the dark brush of the current color group. More... | |
const QBrush & | foreground () const |
Use windowText() instead. More... | |
const QBrush & | highlight () const |
Returns the highlight brush of the current color group. More... | |
const QBrush & | highlightedText () const |
Returns the highlighted text brush of the current color group. More... | |
bool | isBrushSet (ColorGroup cg, ColorRole cr) const |
Returns true if the ColorGroup cg and ColorRole cr has been set previously on this palette; otherwise returns false. More... | |
bool | isCopyOf (const QPalette &p) const |
Returns true if this palette and p are copies of each other, i.e. More... | |
bool | isEqual (ColorGroup cr1, ColorGroup cr2) const |
Returns true (usually quickly) if color group cg1 is equal to cg2; otherwise returns false. More... | |
const QBrush & | light () const |
Returns the light brush of the current color group. More... | |
const QBrush & | link () const |
Returns the unvisited link text brush of the current color group. More... | |
const QBrush & | linkVisited () const |
Returns the visited link text brush of the current color group. More... | |
const QBrush & | mid () const |
Returns the mid brush of the current color group. More... | |
const QBrush & | midlight () const |
Returns the midlight brush of the current color group. More... | |
operator QVariant () const | |
Returns the palette as a QVariant. More... | |
bool | operator!= (const QPalette &p) const |
Returns true (slowly) if this palette is different from p; otherwise returns false (usually quickly). More... | |
QPalette & | operator= (const QPalette &palette) |
Assigns p to this palette and returns a reference to this palette. More... | |
bool | operator== (const QPalette &p) const |
Returns true (usually quickly) if this palette is equal to p; otherwise returns false (slowly). More... | |
QPalette () | |
Constructs a palette object that uses the application's default palette. More... | |
QPalette (const QColor &button) | |
Constructs a palette from the button color. More... | |
QPalette (Qt::GlobalColor button) | |
Constructs a palette from the button color. More... | |
QPalette (const QColor &button, const QColor &window) | |
Constructs a palette from a button color and a window. More... | |
QPalette (const QBrush &windowText, const QBrush &button, const QBrush &light, const QBrush &dark, const QBrush &mid, const QBrush &text, const QBrush &bright_text, const QBrush &base, const QBrush &window) | |
Constructs a palette. More... | |
QPalette (const QColor &windowText, const QColor &window, const QColor &light, const QColor &dark, const QColor &mid, const QColor &text, const QColor &base) | |
QPalette (const QPalette &palette) | |
Constructs a copy of p. More... | |
QPalette | resolve (const QPalette &) const |
Returns a new QPalette that has attributes copied from other. More... | |
uint | resolve () const |
void | resolve (uint mask) |
int | serialNumber () const |
Returns a number that identifies the contents of this QPalette object. More... | |
void | setBrush (ColorRole cr, const QBrush &brush) |
Sets the brush for the given color role to the specified brush for all groups in the palette. More... | |
void | setBrush (ColorGroup cg, ColorRole cr, const QBrush &brush) |
Sets the brush in the specified color group, used for the given color role, to brush. More... | |
void | setColor (ColorGroup cg, ColorRole cr, const QColor &color) |
Sets the color in the specified color group, used for the given color role, to the specified solid color. More... | |
void | setColor (ColorRole cr, const QColor &color) |
Sets the color used for the given color role, in all color groups, to the specified solid color. More... | |
void | setColorGroup (ColorGroup cr, const QBrush &windowText, const QBrush &button, const QBrush &light, const QBrush &dark, const QBrush &mid, const QBrush &text, const QBrush &bright_text, const QBrush &base, const QBrush &window) |
Sets a the group at cg. More... | |
void | setCurrentColorGroup (ColorGroup cg) |
Set the palette's current color group to cg. More... | |
const QBrush & | shadow () const |
Returns the shadow brush of the current color group. More... | |
const QBrush & | text () const |
Returns the text foreground brush of the current color group. More... | |
const QBrush & | toolTipBase () const |
Returns the tool tip base brush of the current color group. More... | |
const QBrush & | toolTipText () const |
Returns the tool tip text brush of the current color group. More... | |
const QBrush & | window () const |
Returns the window (general background) brush of the current color group. More... | |
const QBrush & | windowText () const |
Returns the window text (general foreground) brush of the current color group. More... | |
~QPalette () | |
Destroys the palette. More... | |
Private Functions | |
void | detach () |
void | init () |
void | setColorGroup (ColorGroup cr, const QBrush &windowText, const QBrush &button, const QBrush &light, const QBrush &dark, const QBrush &mid, const QBrush &text, const QBrush &bright_text, const QBrush &base, const QBrush &alternate_base, const QBrush &window, const QBrush &midlight, const QBrush &button_text, const QBrush &shadow, const QBrush &highlight, const QBrush &highlighted_text, const QBrush &link, const QBrush &link_visited) |
void | setColorGroup (ColorGroup cr, const QBrush &windowText, const QBrush &button, const QBrush &light, const QBrush &dark, const QBrush &mid, const QBrush &text, const QBrush &bright_text, const QBrush &base, const QBrush &alternate_base, const QBrush &window, const QBrush &midlight, const QBrush &button_text, const QBrush &shadow, const QBrush &highlight, const QBrush &highlighted_text, const QBrush &link, const QBrush &link_visited, const QBrush &toolTipBase, const QBrush &toolTipText) |
Properties | |
uint | current_group: 4 |
QPalettePrivate * | d |
uint | resolve_mask: 28 |
Friends | |
Q_GUI_EXPORT QDataStream & | operator<< (QDataStream &s, const QPalette &p) |
Writes the palette, p to the stream s and returns a reference to the stream. More... | |
Related Functions | |
(Note that these are not member functions.) | |
QDataStream & | operator>> (QDataStream &s, QPalette &p) |
Reads a palette from the stream, s into the palette p, and returns a reference to the stream. More... | |
The QPalette class contains color groups for each widget state.
A palette consists of three color groups: Active, Disabled, and Inactive. All widgets in Qt contain a palette and use their palette to draw themselves. This makes the user interface easily configurable and easier to keep consistent.
If you create a new widget we strongly recommend that you use the colors in the palette rather than hard-coding specific colors.
The color groups:
Both active and inactive windows can contain disabled widgets. (Disabled widgets are often called inaccessible or grayed out.)
In most styles, Active and Inactive look the same.
Colors and brushes can be set for particular roles in any of a palette's color groups with setColor() and setBrush(). A color group contains a group of colors used by widgets for drawing themselves. We recommend that widgets use color group roles from the palette such as "foreground" and "base" rather than literal colors like "red" or "turquoise". The color roles are enumerated and defined in the ColorRole documentation.
We strongly recommend that you use the default palette of the current style (returned by QApplication::palette()) and modify that as necessary. This is done by Qt's widgets when they are drawn.
To modify a color group you call the functions setColor() and setBrush(), depending on whether you want a pure color or a pixmap pattern.
There are also corresponding color() and brush() getters, and a commonly used convenience function to get the ColorRole for the current ColorGroup: window(), windowText(), base(), etc.
You can copy a palette using the copy constructor and test to see if two palettes are identical using isCopyOf().
QPalette is optimized by the use of implicit sharing, so it is very efficient to pass QPalette objects as arguments.
Definition at line 61 of file qpalette.h.
enum QPalette::ColorGroup |
Enumerator | |
---|---|
Active | |
Disabled | |
Inactive | |
NColorGroups | |
Current | |
All | |
Normal |
Definition at line 92 of file qpalette.h.
enum QPalette::ColorRole |
The ColorRole enum defines the different symbolic color roles used in current GUIs.
The central roles are:
Base
. This is usually the same as the WindowText
, in which case it must provide good contrast with Window
and Base
.Window
as some styles require a different background color for buttons.Button
color.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
.
Button
color.Button
and Light
.Button
.Button
and Dark
.Selected (marked) items have two roles:
Highlight
. By default, the highlighted text color is Qt::white.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:
Definition at line 93 of file qpalette.h.
QPalette::QPalette | ( | ) |
Constructs a palette object that uses the application's default palette.
Definition at line 673 of file qpalette.cpp.
Referenced by operator>>(), qt_mix_colors(), and setBrush().
QPalette::QPalette | ( | const QColor & | button | ) |
Constructs a palette from the button color.
The other colors are automatically calculated, based on this color. Window
will be the button color as well.
Definition at line 713 of file qpalette.cpp.
QPalette::QPalette | ( | Qt::GlobalColor | button | ) |
Constructs a palette from the button color.
The other colors are automatically calculated, based on this color. Window
will be the button color as well.
Definition at line 724 of file qpalette.cpp.
Constructs a palette from a button color and a window.
The other colors are automatically calculated, based on these colors.
Definition at line 770 of file qpalette.cpp.
QPalette::QPalette | ( | const QBrush & | windowText, |
const QBrush & | button, | ||
const QBrush & | light, | ||
const QBrush & | dark, | ||
const QBrush & | mid, | ||
const QBrush & | text, | ||
const QBrush & | bright_text, | ||
const QBrush & | base, | ||
const QBrush & | window | ||
) |
Constructs a palette.
You can pass either brushes, pixmaps or plain colors for windowText, button, light, dark, mid, text, bright_text, base and window.
Definition at line 737 of file qpalette.cpp.
QPalette::QPalette | ( | const QColor & | windowText, |
const QColor & | window, | ||
const QColor & | light, | ||
const QColor & | dark, | ||
const QColor & | mid, | ||
const QColor & | text, | ||
const QColor & | base | ||
) |
Constructs a palette with the specified windowText, window, light, dark, mid, text, and base colors. The button color will be set to the window color.
Definition at line 755 of file qpalette.cpp.
QPalette::QPalette | ( | const QPalette & | p | ) |
Constructs a copy of p.
This constructor is fast thanks to implicit sharing.
Definition at line 802 of file qpalette.cpp.
QPalette::~QPalette | ( | ) |
|
inline |
Returns the alternate base brush of the current color group.
Definition at line 131 of file qpalette.h.
Referenced by QWindowsVistaStyle::drawPrimitive().
|
inline |
Use window() instead.
Definition at line 134 of file qpalette.h.
Referenced by QPlastiqueStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QCommonStyle::drawControl(), QWindowsVistaStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QMacStyle::drawControl(), QWindowsCEStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QCDEStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QComboMenuDelegate::paint(), QPlainTextEdit::paintEvent(), QWindowsStyle::polish(), qt_plastique_draw_handle(), qt_plastique_drawFrame(), qt_plastique_drawShadedPanel(), qt_set_windows_color_resources(), setBrush(), QInputContext::standardFormat(), and QCleanlooksStyle::styleHint().
|
inline |
Returns the base brush of the current color group.
Definition at line 130 of file qpalette.h.
Referenced by QPlastiqueStyle::drawComplexControl(), QWindowsMobileStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QCommonStyle::drawControl(), QWindowsCEStyle::drawControl(), QWindowsVistaStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QMotifStyle::drawControl(), QWindowsCEStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QWindowsXPStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QWizardHeader::paintEvent(), QWindowsXPStyle::polish(), QWindowsVistaStyle::polish(), QPalette(), qt_palette_from_color(), qt_set_windows_color_resources(), setBrush(), and QGtkStyle::standardPalette().
|
inline |
Returns the bright text foreground brush of the current color group.
Definition at line 137 of file qpalette.h.
Referenced by QWindowsCEStyle::drawPrimitive(), qt_set_windows_color_resources(), and setBrush().
const QBrush & QPalette::brush | ( | ColorGroup | group, |
ColorRole | role | ||
) | const |
Returns the brush in the specified color group, used for the given color role.
Definition at line 874 of file qpalette.cpp.
Referenced by QLineControl::draw(), QItemDelegate::drawBackground(), QWindowsCEStyle::drawComplexControl(), QCommonStyle::drawComplexControl(), QWindowsMobileStyle::drawComplexControl(), QWindowsStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QWindowsCEStyle::drawControl(), QCommonStyle::drawControl(), QCDEStyle::drawControl(), QWindowsMobileStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QStyleSheetStyle::drawControl(), QItemDelegate::drawDisplay(), QCleanlooksStyle::drawItemText(), QStyle::drawItemText(), QTextDocumentLayoutPrivate::drawListItem(), QWindowsMobileStylePrivate::drawPanelItemViewSelected(), QWindowsCEStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCDEStyle::drawPrimitive(), QWindowsXPStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QStyleSheetStyle::drawPrimitive(), QCalendarModel::formatForCell(), QTextControl::getPaintContext(), QPainter::initFrom(), QApplicationPrivate::initializeWidgetPaletteHash(), QWidgetPrivate::isBackgroundInherited(), QDecorationDefault::paint(), QDecorationWindows::paintButton(), QDecorationDefault::paintButton(), QGraphicsView::paintEvent(), QMotifStyle::polish(), qDrawPlainRect(), qt_mac_display_change_callbk(), QWidget::testAttribute(), QDirectFBWindowSurface::updateIsOpaque(), and QWidgetPrivate::updateIsOpaque().
Returns the brush that has been set for the given color role in the current ColorGroup.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 122 of file qpalette.h.
Referenced by brush().
|
inline |
Returns the button brush of the current color group.
Definition at line 125 of file qpalette.h.
Referenced by QCommonStyle::drawComplexControl(), QWindowsCEStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QWindowsMobileStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QWindowsStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QWindowsCEStyle::drawControl(), QPlastiqueStyle::drawControl(), QWindowsMobileStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsStyle::drawControl(), QMotifStyle::drawControl(), QStyleHelper::drawDial(), QWindowsCEStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QWindowsMobileStylePrivate::drawScrollbarGrip(), QWindowsMobileStylePrivate::drawScrollbarGroove(), QWindowsMobileStylePrivate::drawScrollbarHandleDown(), QWindowsMobileStylePrivate::drawScrollbarHandleUp(), QWindowsMobileStylePrivate::drawTabBarTab(), QWindowsCEStylePrivate::drawWinCEButton(), QWindowsCEStylePrivate::drawWinCEPanel(), QWindowsMobileStyle::polish(), qDrawPlainRect(), qDrawWinButton(), QPalette(), qt_cleanlooks_draw_mdibutton(), qt_palette_from_color(), qt_plastique_drawFrame(), qt_plastique_drawShadedPanel(), qt_set_windows_color_resources(), and setBrush().
|
inline |
Returns the button text foreground brush of the current color group.
Definition at line 138 of file qpalette.h.
Referenced by QPlastiqueStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QPlastiqueStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QStyleSheetStyle::drawControl(), QWindowsCEStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QCommandLinkButton::paintEvent(), and setBrush().
qint64 QPalette::cacheKey | ( | ) | const |
Returns a number that identifies the contents of this QPalette object.
Distinct QPalette objects can have the same key if they refer to the same contents.
The cacheKey() will change when the palette is altered.
Definition at line 1093 of file qpalette.cpp.
Referenced by QPixmapIconEngine::pixmap(), and QStyleHelper::uniqueName().
|
inline |
Returns the color in the specified color group, used for the given color role.
Definition at line 107 of file qpalette.h.
Referenced by brushFromData(), QCss::Declaration::brushValue(), QCss::Declaration::brushValues(), colorFromData(), QCss::Declaration::colorValue(), QCss::Declaration::colorValues(), QEgl::createSurface(), QGraphicsTextItem::defaultTextColor(), QMdiSubWindowPrivate::desktopPalette(), QTextDocumentLayoutPrivate::drawBlock(), QPlastiqueStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QWindowsVistaStyle::drawControl(), QCommonStyle::drawControl(), QCDEStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsXPStyle::drawControl(), QMacStyle::drawControl(), QItemDelegate::drawDisplay(), QItemDelegate::drawFocus(), QTextDocumentLayoutPrivate::drawFrame(), QWindowsCEStyle::drawItemText(), QPlastiqueStyle::drawPrimitive(), QTreeView::drawRow(), QLCDNumberPrivate::drawSegment(), QScriptEdit::extraAreaPaintEvent(), QCommonStyle::generatedIconPixmap(), QDeclarativeTextEditPrivate::init(), QDeclarativeTextInputPrivate::init(), QApplicationPrivate::initializeWidgetPaletteHash(), QAxClientSite::Invoke(), QAccessibleWidgetEx::invokeMethodEx(), QApplication::isLeftToRight(), QDecorationWindows::paint(), QDecorationStyled::paint(), QDecorationDefault::paint(), QDecorationWindows::paintButton(), QLabel::paintEvent(), QCalToolButton::paintEvent(), QmlJSDebugger::ColorPickerTool::pickColor(), QMotifStyle::polish(), qDrawShadeLine(), QRenderRule::QRenderRule(), qt_plastique_draw_handle(), qt_plastique_drawFrame(), qt_set_windows_color_resources(), QWorkspaceTitleBarPrivate::readColors(), QItemDelegate::selected(), setBrush(), QGraphicsTextItem::setDefaultTextColor(), QApplicationPrivate::setSystemPalette(), QPlastiqueStyle::standardPalette(), QMotifStyle::standardPixmap(), QCommonStyle::styleHint(), QWindowsVistaStyle::styleHint(), QWidget::testAttribute(), and QToolBoxPrivate::updateTabs().
Returns the color that has been set for the given color role in the current ColorGroup.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 121 of file qpalette.h.
Referenced by color().
|
inline |
Returns the palette's current color group.
Definition at line 104 of file qpalette.h.
Referenced by QCleanlooksStyle::drawControl(), QMacStyle::drawPrimitive(), QMacStylePrivate::initComboboxBdi(), QMacStylePrivate::initHIThemePushButton(), and QLineEdit::paintEvent().
|
inline |
Returns the dark brush of the current color group.
Definition at line 127 of file qpalette.h.
Referenced by QCommonStyle::drawComplexControl(), QWindowsCEStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QWindowsCEStyle::drawControl(), QCommonStyle::drawControl(), QPlastiqueStyle::drawControl(), QWindowsMobileStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QStyleHelper::drawDial(), QWindowsCEStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCDEStyle::drawPrimitive(), QWindowsXPStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QLCDNumberPrivate::drawSegment(), QWindowsCEStylePrivate::drawWinCEButton(), QWindowsCEStylePrivate::drawWinCEPanel(), QWindowsStyle::polish(), qDrawPlainRect(), qDrawShadeLine(), qDrawShadePanel(), qDrawShadeRect(), qDrawWinButton(), qDrawWinPanel(), qt_set_windows_color_resources(), setBrush(), and QWorkspace::sizeHint().
|
private |
Definition at line 953 of file qpalette.cpp.
Referenced by linkVisited(), resolve(), setBrush(), and setColorGroup().
|
inline |
Use windowText() instead.
Definition at line 123 of file qpalette.h.
Referenced by QCommonStyle::drawComplexControl(), QCommonStyle::drawControl(), QMotifStyle::drawControl(), QCommonStyle::drawPrimitive(), QCDEStyle::drawPrimitive(), QColorLuminancePicker::paintEvent(), qDrawPlainRect(), qt_set_windows_color_resources(), and setBrush().
|
inline |
Returns the highlight brush of the current color group.
Definition at line 140 of file qpalette.h.
Referenced by QCleanlooksStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QCommonStyle::drawControl(), QWindowsMobileStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QStyleHelper::drawDial(), QWindowsMobileStylePrivate::drawPanelItemViewSelected(), QPlastiqueStylePrivate::drawPartialFrame(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QWindowsMobileStylePrivate::drawScrollbarHandleDown(), QWindowsMobileStylePrivate::drawScrollbarHandleUp(), QWindowsMobileStyle::generatedIconPixmap(), QFontFamilyDelegate::paint(), QWindowsStyle::polish(), QCleanlooksStyle::polish(), qt_cleanlooks_draw_mdibutton(), qt_plastique_draw_frame(), qt_set_windows_color_resources(), setBrush(), and QWindowsMobileStyle::standardPixmap().
|
inline |
Returns the highlighted text brush of the current color group.
Definition at line 141 of file qpalette.h.
Referenced by QWindowsXPStyle::drawComplexControl(), QWindowsCEStyle::drawControl(), QPlastiqueStyle::drawControl(), QWindowsMobileStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsXPStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QCommonStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QFontFamilyDelegate::paint(), QCleanlooksStyle::polish(), setBrush(), and QWindowsMobileStyle::standardPixmap().
|
private |
Definition at line 820 of file qpalette.cpp.
Referenced by QPalette().
bool QPalette::isBrushSet | ( | ColorGroup | cg, |
ColorRole | cr | ||
) | const |
Returns true if the ColorGroup cg and ColorRole cr has been set previously on this palette; otherwise returns false.
Definition at line 944 of file qpalette.cpp.
Referenced by QGroupBox::initStyleOption().
bool QPalette::isCopyOf | ( | const QPalette & | p | ) | const |
Returns true if this palette and p are copies of each other, i.e.
one of them was created as a copy of the other and neither was subsequently modified; otherwise returns false. This is much stricter than equality.
Definition at line 1233 of file qpalette.cpp.
Referenced by QWidgetPrivate::naturalWidgetPalette(), operator==(), and QApplicationPrivate::setPalette_helper().
bool QPalette::isEqual | ( | QPalette::ColorGroup | group1, |
QPalette::ColorGroup | group2 | ||
) | const |
Returns true (usually quickly) if color group cg1 is equal to cg2; otherwise returns false.
Definition at line 1035 of file qpalette.cpp.
Referenced by QLineEdit::changeEvent(), and QWidget::event().
|
inline |
Returns the light brush of the current color group.
Definition at line 126 of file qpalette.h.
Referenced by QCommonStyle::drawComplexControl(), QWindowsCEStyle::drawComplexControl(), QWindowsMobileStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QWindowsStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QWindowsCEStyle::drawControl(), QCommonStyle::drawControl(), QWindowsMobileStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsStyle::drawControl(), QMotifStyle::drawControl(), QStyleSheetStyle::drawControl(), QWindowsCEStyle::drawItemText(), QStyle::drawItemText(), QWindowsCEStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QCDEStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QWindowsMobileStylePrivate::drawScrollbarGroove(), QLCDNumberPrivate::drawSegment(), QWindowsMobileStylePrivate::drawTabBarTab(), QWindowsCEStylePrivate::drawWinCEButton(), QWindowsCEStylePrivate::drawWinCEPanel(), QLabel::paintEvent(), qDrawPlainRect(), qDrawShadeLine(), qDrawShadePanel(), qDrawShadeRect(), qDrawWinButton(), qDrawWinPanel(), qt_plastique_draw_handle(), qt_set_windows_color_resources(), and setBrush().
|
inline |
Returns the unvisited link text brush of the current color group.
Definition at line 142 of file qpalette.h.
Referenced by QWindowsCEStyle::drawPrimitive(), and setBrush().
|
inline |
Returns the visited link text brush of the current color group.
Definition at line 143 of file qpalette.h.
Referenced by setBrush().
|
inline |
Returns the mid brush of the current color group.
Definition at line 128 of file qpalette.h.
Referenced by QCleanlooksStyle::drawComplexControl(), QWindowsCEStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QWizardHeader::paintEvent(), qDrawPlainRect(), qDrawShadeLine(), qDrawShadeRect(), qt_set_windows_color_resources(), setBrush(), and QCleanlooksStyle::standardPalette().
|
inline |
Returns the midlight brush of the current color group.
Definition at line 136 of file qpalette.h.
Referenced by QWindowsCEStyle::drawComplexControl(), QWindowsCEStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QWindowsCEStylePrivate::drawWinCEButton(), QWindowsCEStylePrivate::drawWinCEPanel(), qDrawShadePanel(), qDrawWinPanel(), qt_set_windows_color_resources(), and setBrush().
QPalette::operator QVariant | ( | ) | const |
Returns the palette as a QVariant.
Definition at line 846 of file qpalette.cpp.
|
inline |
Returns true (slowly) if this palette is different from p; otherwise returns false (usually quickly).
Definition at line 159 of file qpalette.h.
Referenced by setBrush().
Assigns p to this palette and returns a reference to this palette.
This operation is fast thanks to implicit sharing.
Definition at line 832 of file qpalette.cpp.
bool QPalette::operator== | ( | const QPalette & | p | ) | const |
Returns true (usually quickly) if this palette is equal to p; otherwise returns false (slowly).
Definition at line 992 of file qpalette.cpp.
Referenced by setBrush().
Returns a new QPalette that has attributes copied from other.
Definition at line 1101 of file qpalette.cpp.
Referenced by QGtkStyle::drawComplexControl(), QPlastiqueStyle::drawControl(), QGtkStyle::drawControl(), QGtkStyle::drawPrimitive(), QComboMenuDelegate::getStyleOption(), QGraphicsWidgetPrivate::naturalWidgetPalette(), QWidgetPrivate::naturalWidgetPalette(), QGtkStyle::polish(), QWidgetPrivate::propagatePaletteChange(), QGraphicsWidgetPrivate::resolvePalette(), QGraphicsScenePrivate::resolvePalette(), QWidgetPrivate::resolvePalette(), QGraphicsWidget::setPalette(), QGraphicsScene::setPalette(), QWidget::setPalette(), QGraphicsWidgetPrivate::setPalette_helper(), QGraphicsScenePrivate::setPalette_helper(), QWidgetPrivate::setPalette_helper(), QGraphicsWidgetPrivate::updatePalette(), and QGraphicsScenePrivate::updatePalette().
|
inline |
Definition at line 166 of file qpalette.h.
|
inline |
Definition at line 167 of file qpalette.h.
int QPalette::serialNumber | ( | ) | const |
Returns a number that identifies the contents of this QPalette object.
Distinct QPalette objects can only have the same serial number if they refer to the same contents (but they don't have to). Also, the serial number of a QPalette may change during the lifetime of the object.
Use cacheKey() instead.
Definition at line 1081 of file qpalette.cpp.
Sets the brush for the given color role to the specified brush for all groups in the palette.
Definition at line 206 of file qpalette.h.
Referenced by QGtkStylePrivate::applyCustomPaletteHash(), QRenderRule::configurePalette(), QCleanlooksStyle::drawComplexControl(), QWindowsStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QCleanlooksStyle::drawControl(), QGtkStyle::drawControl(), QStyleSheetStyle::drawControl(), QStyleSheetStyle::drawPrimitive(), QComboMenuDelegate::getStyleOption(), QGtkStylePrivate::gtkWidgetPalette(), QApplicationPrivate::initializeWidgetPaletteHash(), QStyledItemDelegate::initStyleOption(), kdeColor(), operator>>(), QWhatsThat::paintEvent(), QHeaderView::paintSection(), QWindowsXPStyle::polish(), QMacStyle::polish(), QWindowsVistaStyle::polish(), QPlastiqueStyle::polish(), QCleanlooksStyle::polish(), QWizardPrivate::recreateLayout(), setColorGroup(), QItemDelegate::setOptions(), QTabBarPrivate::setupMovableTab(), QCleanlooksStyle::standardPalette(), QCDEStyle::standardPalette(), QPlastiqueStyle::standardPalette(), QStyle::standardPalette(), QMotifStyle::standardPalette(), QWidget::testAttribute(), and QCalendarTextNavigator::updateDateLabel().
void QPalette::setBrush | ( | ColorGroup | group, |
ColorRole | role, | ||
const QBrush & | brush | ||
) |
Sets the brush in the specified color group, used for the given color role, to brush.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 912 of file qpalette.cpp.
|
inline |
Sets the color in the specified color group, used for the given color role, to the specified solid color.
Definition at line 201 of file qpalette.h.
Referenced by QMdiSubWindowPrivate::desktopPalette(), QWindowsCEStyle::drawComplexControl(), QWindowsStyle::drawComplexControl(), QStyleSheetStyle::drawComplexControl(), QWindowsCEStyle::drawControl(), QWindowsVistaStyle::drawControl(), QCommonStyle::drawControl(), QWindowsMobileStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsXPStyle::drawControl(), QWindowsStyle::drawControl(), QMotifStyle::drawControl(), QMacStyle::drawControl(), QStyleSheetStyle::drawControl(), QWindowsCEStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QDeclarativeTextEditPrivate::init(), QApplicationPrivate::initializeWidgetPaletteHash(), QTabBar::initStyleOption(), QApplication::isLeftToRight(), QAxServerBase::OnAmbientPropertyChange(), QDecorationStyled::paint(), QDeclarativeText::paint(), QCommandLinkButton::paintEvent(), QLabel::paintEvent(), QCalToolButton::paintEvent(), QStaticTextPrivate::paintText(), QMotifStyle::polish(), QMacStyle::polish(), QWindowsVistaStyle::polish(), QWindowsMobileStyle::polish(), printPage(), QBalloonTip::QBalloonTip(), QApplicationPrivate::qt_mac_apply_settings(), qt_mix_colors(), qt_set_windows_color_resources(), QWorkspaceTitleBarPrivate::readColors(), readV1ColorGroup(), QWizardPrivate::recreateLayout(), QDeclarativeTextEdit::setColor(), QGraphicsTextItem::setDefaultTextColor(), QScriptDebuggerCodeFinderWidget::setOK(), QDeclarativeTextInput::setSelectedTextColor(), QDeclarativeTextEdit::setSelectedTextColor(), QDeclarativeTextInput::setSelectionColor(), QDeclarativeTextEdit::setSelectionColor(), QApplicationPrivate::setSystemPalette(), QGtkStyle::standardPalette(), QWindowsCEStyle::standardPalette(), QMacStyle::standardPalette(), QWindowsMobileStyle::standardPalette(), QWidget::testAttribute(), QDeclarativeTextPrivate::textDocumentImage(), QToolBoxPrivate::updateTabs(), and QApplicationPrivate::x11_apply_settings().
Sets the color used for the given color role, in all color groups, to the specified solid color.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 204 of file qpalette.h.
void QPalette::setColorGroup | ( | ColorGroup | cg, |
const QBrush & | windowText, | ||
const QBrush & | button, | ||
const QBrush & | light, | ||
const QBrush & | dark, | ||
const QBrush & | mid, | ||
const QBrush & | text, | ||
const QBrush & | bright_text, | ||
const QBrush & | base, | ||
const QBrush & | window | ||
) |
Sets a the group at cg.
You can pass either brushes, pixmaps or plain colors for windowText, button, light, dark, mid, text, bright_text, base and window.
Definition at line 1246 of file qpalette.cpp.
Referenced by QPalette(), qt_mix_colors(), qt_palette_from_color(), qt_set_windows_color_resources(), and setColorGroup().
|
private |
Definition at line 1271 of file qpalette.cpp.
|
private |
Definition at line 1287 of file qpalette.cpp.
|
inline |
Set the palette's current color group to cg.
Definition at line 105 of file qpalette.h.
Referenced by QTableViewPrivate::drawCell(), QWindowsCEStyle::drawComplexControl(), QCommonStyle::drawComplexControl(), QWindowsMobileStyle::drawComplexControl(), QWindowsStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QMacStyle::drawControl(), QPlastiqueStyle::drawPrimitive(), QTreeView::drawRow(), QScriptEdit::extraAreaPaintEvent(), QComboMenuDelegate::getStyleOption(), QMenuBar::initStyleOption(), QMenu::initStyleOption(), QGraphicsWidget::initStyleOption(), QListView::paintEvent(), QTabBar::paintEvent(), QWorkspaceTitleBar::paintEvent(), QGraphicsWidget::paintWindowFrame(), QWidget::setForegroundRole(), and QMdiSubWindowPrivate::titleBarOptions().
|
inline |
Returns the shadow brush of the current color group.
Definition at line 139 of file qpalette.h.
Referenced by QWindowsCEStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QWindowsMobileStyle::drawComplexControl(), QWindowsCEStyle::drawControl(), QWindowsMobileStyle::drawControl(), QPlastiqueStyle::drawControl(), QWindowsStyle::drawControl(), QMotifStyle::drawControl(), QWindowsCEStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QWindowsXPStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QWindowsMobileStylePrivate::drawScrollbarHandleDown(), QWindowsMobileStylePrivate::drawScrollbarHandleUp(), QWindowsMobileStylePrivate::drawTabBarTab(), QWindowsCEStylePrivate::drawWinCEButton(), QWindowsCEStylePrivate::drawWinCEPanel(), qDrawShadePanel(), qDrawWinButton(), qDrawWinPanel(), qt_plastique_draw_frame(), setBrush(), and QWindowsMobileStyle::standardPixmap().
|
inline |
Returns the text foreground brush of the current color group.
Definition at line 129 of file qpalette.h.
Referenced by QWindowsXPStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QMacStyle::drawComplexControl(), QCleanlooksStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QStyleSheetStyle::drawControl(), QTextDocumentLayoutPrivate::drawListItem(), QWindowsCEStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QLineEdit::paintEvent(), qDrawPlainRect(), qt_set_windows_color_resources(), setBrush(), and QInputContext::standardFormat().
|
inline |
Returns the tool tip base brush of the current color group.
This brush is used by QToolTip and QWhatsThis.
Definition at line 132 of file qpalette.h.
Referenced by QCommonStyle::drawPrimitive(), and setColorGroup().
|
inline |
Returns the tool tip text brush of the current color group.
This brush is used by QToolTip and QWhatsThis.
Definition at line 133 of file qpalette.h.
Referenced by QCommonStyle::drawPrimitive(), QWhatsThat::paintEvent(), and setColorGroup().
|
inline |
Returns the window (general background) brush of the current color group.
Definition at line 135 of file qpalette.h.
Referenced by _q_paintItem(), QPlastiqueStyle::drawControl(), QPlastiqueStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QWindowsMobileStylePrivate::drawTabBarTab(), make_widget_eventUPP(), QDecorationStyled::paint(), and QPalette().
|
inline |
Returns the window text (general foreground) brush of the current color group.
Definition at line 124 of file qpalette.h.
Referenced by QPlastiqueStyle::drawControl(), QMacStyle::drawControl(), and qt_graphicsItem_highlightSelected().
|
friend |
Writes the palette, p to the stream s and returns a reference to the stream.
Definition at line 1154 of file qpalette.cpp.
Referenced by setBrush().
|
related |
Reads a palette from the stream, s into the palette p, and returns a reference to the stream.
Definition at line 1195 of file qpalette.cpp.
Referenced by setBrush().
|
private |
Definition at line 196 of file qpalette.h.
Referenced by brush(), init(), isEqual(), operator=(), operator==(), QPalette(), and setBrush().
|
private |
Definition at line 195 of file qpalette.h.
Referenced by brush(), cacheKey(), detach(), init(), isCopyOf(), isEqual(), operator=(), operator==(), QPalette(), resolve(), serialNumber(), setBrush(), and ~QPalette().
|
private |
Definition at line 197 of file qpalette.h.
Referenced by init(), isBrushSet(), operator=(), QPalette(), resolve(), setBrush(), and setColorGroup().