QColorGroup Class Reference
The QColorGroup class contains a group of widget colors.
More...
#include <qpalette.h>
List of all member functions.
Public Members
- QColorGroup ()
- QColorGroup ( const QColor & foreground, const QColor & button, const QColor & light, const QColor & dark, const QColor & mid, const QColor & text, const QColor & base )
- QColorGroup ( const QBrush & foreground, const QBrush & button, const QBrush & light, const QBrush & dark, const QBrush & mid, const QBrush & text, const QBrush & bright_text, const QBrush & base, const QBrush & background )
- QColorGroup ( const QColorGroup & )
- ~QColorGroup ()
- enum ColorRole { Foreground, Button, Light, Midlight, Dark, Mid, Text, BrightText, ButtonText, Base, Background, Shadow, Highlight, HighlightedText, NColorRoles }
- const QColor& color ( ColorRole ) const
- const QBrush& brush ( ColorRole ) const
- void setColor ( ColorRole, const QColor & )
- void setBrush ( ColorRole, const QBrush & )
- const QColor& foreground () const
- const QColor& button () const
- const QColor& light () const
- const QColor& dark () const
- const QColor& mid () const
- const QColor& text () const
- const QColor& base () const
- const QColor& background () const
- const QColor& midlight () const
- const QColor& brightText () const
- const QColor& buttonText () const
- const QColor& shadow () const
- const QColor& highlight () const
- const QColor& highlightedText () const
- bool operator== ( const QColorGroup & g ) const
- bool operator!= ( const QColorGroup & g ) const
Related Functions
(Note that these are not member functions.)
- QDataStream & operator>> (QDataStream & s, QColorGroup & g)
- QDataStream & operator<< (QDataStream & s, const QColorGroup & g)
Detailed Description
The QColorGroup class contains a group of widget colors.
A color group contains a group of colors used by widgets for drawing
themselves. Widgets should not use colors like "red" and "turqoise"
but rather "foreground" and "base", where possible.
We have identified fourty-two distinct color roles:
- Foreground (graphics foreground color)
- Button (general button color)
- Light (lighter than button color, for shadow effects)
- Midlight (between Button and Light, for shadow effects)
- Dark (darker than the button color, for shadow effects)
- Medium (between button color and dark, used for shadow and contrast
effects)
- Text (usually the same as the foreground color, but sometimes text
and other foreground are not the same)
- BrightText (a text color that contrasts to the Dark color)
- ButtonText (a text color that contrasts to the Button color)
- Base (used as background color for some widgets). Usually white or
another light color.
- Background (general background color)
- Shadow (a very dark color used for shadow effects, usually black)
- Highlight (a color to indicate a selected or highlighted item)
- HighlightedText (a text color that contrasts to Highlight)
A QPalette contains three color groups.
The current widget color group is returned by QWidget::colorGroup().
See also: QColor and QPalette.
Member Function Documentation
QColorGroup::QColorGroup ()
Constructs a color group with all colors set to black.
QColorGroup::QColorGroup ( const QBrush & foreground, const QBrush & button, const QBrush & light, const QBrush & dark, const QBrush & mid, const QBrush & text, const QBrush & bright_text, const QBrush & base, const QBrush & background )
Constructs a color group. You can pass either brushes, pixmaps or
plain colors for each parameter.
See also: QBrush.
QColorGroup::QColorGroup ( const QColor & foreground, const QColor & button, const QColor & light, const QColor & dark, const QColor & mid, const QColor & text, const QColor & base )
This function is obsolete. It is provided to keep old programs working. We strongly advise against using it in new code.
Constructs a color group with the specified colors. The background
color will be set to the button color.
QColorGroup::QColorGroup ( const QColorGroup & other )
Constructs a color group that is an independent copy of another color group.
QColorGroup::~QColorGroup ()
Destroys the color group.
const QColor & QColorGroup::background () const
Returns the background color of the color group.
const QColor & QColorGroup::base () const
Returns the base color of the color group.
const QColor & QColorGroup::brightText () const
Returns the bright text foreground color of the color group.
const QBrush & QColorGroup::brush ( ColorRole r ) const
Returns the brush that has been set for color role r.
const QColor & QColorGroup::button () const
Returns the button color of the color group.
const QColor & QColorGroup::buttonText () const
Returns the button text foreground color of the color group.
const QColor & QColorGroup::color ( ColorRole r ) const
Returns the color that has been set for color role r.
See also: brush().
const QColor & QColorGroup::dark () const
Returns the dark color of the color group.
const QColor & QColorGroup::foreground () const
Returns the foreground color of the color group.
const QColor & QColorGroup::highlight () const
Returns the highlight color of the color group.
const QColor & QColorGroup::highlightedText () const
Returns the highlighted text color of the color group.
const QColor & QColorGroup::light () const
Returns the light color of the color group.
const QColor & QColorGroup::mid () const
Returns the medium color of the color group.
const QColor& QColorGroup::midlight () const
Returns the midlight color of the color group. Currently, this is
a lightened version of the button color, but this may change
in the future, to return a const QColor & from the
palette.
bool QColorGroup::operator!= ( const QColorGroup & g ) const
Returns TRUE if this color group is different from g, or FALSE if
it is equal to g.
See also: operator!=().
bool QColorGroup::operator== ( const QColorGroup & g ) const
Returns TRUE if this color group is equal to g, or FALSE if
it is different from g.
See also: operator==().
void QColorGroup::setBrush ( ColorRole r, const QBrush & b )
Sets the brush used for color role r to b.
void QColorGroup::setColor ( ColorRole r, const QColor & c )
Sets the brush used for color role r to a solid color c.
const QColor & QColorGroup::shadow () const
Returns the shadow color of the color group.
const QColor & QColorGroup::text () const
Returns the text foreground color of the color group.
Related Functions
Reads a color group from the stream.
Writes a color group to the stream.
Serialization format:
- QBrush foreground
- QBrush button
- QBrush light
- QBrush midLight
- QBrush dark
- QBrush mid
- QBrush text
- QBrush brightText
- QBrush ButtonText
- QBrush base
- QBrush background
- QBrush shadow
- QBrush highlight
- QBrush highlightedText
The colors are serialized in the listed order.
Search the documentation, FAQ, qt-interest archive and more (uses
www.troll.no):
This file is part of the Qt toolkit,
copyright © 1995-99
Troll Tech, all rights reserved.
Copyright İ 1999 Troll Tech | Trademarks
| Qt version 2.0.2
|