QColorGroup Class Reference


The QColorGroup class contains a group of widget colors. More...

#include <qpalette.h>

List of all member functions.

Public Members

Related Functions

(Note that these are not member functions.)

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 seven distinct color roles:

  1. Foreground (graphics foreground color)
  2. Background (general background color)
  3. Light (lighter than background color, for shadow effects)
  4. Dark (darker than the background color, for shadow effects)
  5. Medium (between background and dark, used for shadow and contrast effects)
  6. Text (usually the same as the foreground color, but sometimes text and other foreground are not the same)
  7. Base (used as background color for some widgets). Usually white or another light color.

We have not seen any good, well-made and usable widgets that use more than these seven color roles.

A QPalette contains 3 color groups.

The current widget color group is returned by QWidget::colorGroup().

See also: QColor and QPalette.

Examples: widgets/widgets.cpp


Member Function Documentation

QColorGroup::QColorGroup ( const QColor &foreground, const QColor &background, const QColor &light, const QColor &dark, const QColor &mid, const QColor &text, const QColor &base)

Constructs a color group with the specified colors.

QColorGroup::QColorGroup ()

Constructs a color group with all colors set to black.

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::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::light () const

Returns the light color of the color group.

const QColor & QColorGroup::mid () const

Returns the medium color of the color group.

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==().

const QColor & QColorGroup::text () const

Returns the text foreground color of the color group.


Related Functions

QDataStream & operator<< ( QDataStream &s, const QColorGroup &g)

Writes a color group to the stream.

Serialization format:

  1. QColor foreground
  2. QColor background
  3. QColor light
  4. QColor dark
  5. QColor mid
  6. QColor text
  7. QColor base
The colors are serialized in the listed order.

QDataStream & operator>> ( QDataStream &s, QColorGroup &g)

Reads a color group from the stream.


This file is part of the Qt toolkit, copyright © 1995-96 Troll Tech, all rights reserved.

It was generated from the following files:


Generated at 16:51, 1996/09/24 for Qt version 1.0 by the webmaster at Troll Tech