QColorGroup(3qt)

πŸ“¦ version 3.3.8b, in fedora 43, fedora 44

πŸ’– QColorGroup πŸ’– β€” the QColorGroup(3qt) manual, bestie edition

okay so you opened the QColorGroup(3qt) page and you're like "what is this" β€” don't worry, I got you. This is the whole thing, every single flag, role and default, just with the vibes turned all the way up. Let's go 🫢


🌈 NAME 🌈

QColorGroup β€” a whole group of widget colors. That's it. That's the name. A squad of colors, if you will. πŸ’…


✨ SYNOPSIS ✨

#include <qpalette.h>

πŸŽ€ Public Members πŸŽ€

QColorGroup ()
QColorGroup ( const QColor & foreground, const QColor & background,
    const QColor & light, const QColor & dark, const QColor & mid, const
    QColor & text, const QColor & base )  (obsolete)
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 & other )
~QColorGroup ()
QColorGroup & operator= ( const QColorGroup & other )
enum ColorRole { Foreground, Button, Light, Midlight, Dark, Mid, Text,
    BrightText, ButtonText, Base, Background, Shadow, Highlight,
    HighlightedText, Link, LinkVisited, NColorRoles }
const QColor & color ( ColorRole r ) const
const QBrush & brush ( ColorRole r ) const
void setColor ( ColorRole r, const QColor & c )
void setBrush ( ColorRole r, const QBrush & b )
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
const QColor & link () const
const QColor & linkVisited () const
bool operator== ( const QColorGroup & g ) const
bool operator!= ( const QColorGroup & g ) const

so like, quick rundown of what's in the box:

  • QColorGroup () β€” the default one, everything's black.
  • QColorGroup ( ... ) with seven QColors β€” the obsolete one, no cap, the docs literally say don't use it in new code.
  • QColorGroup ( ... ) with nine QBrushes β€” the real one, brushes/pixmaps/plain colors all welcome.
  • QColorGroup ( const QColorGroup & other ) β€” copy constructor, makes an independent twin.
  • ~QColorGroup () β€” destructor, bye.
  • operator= β€” copies another group's colors onto you.
  • enum ColorRole β€” the icon list of roles: Foreground, Button, Light, Midlight, Dark, Mid, Text, BrightText, ButtonText, Base, Background, Shadow, Highlight, HighlightedText, Link, LinkVisited, NColorRoles.
  • color() / brush() β€” getters by role.
  • setColor() / setBrush() β€” setters by role.
  • a whole bouquet of convenience getters: foreground(), button(), light(), dark(), mid(), text(), base(), background(), midlight(), brightText(), buttonText(), shadow(), highlight(), highlightedText(), link(), linkVisited().
  • operator== / operator!= β€” are you the same or not, fr fr.

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

(it gets its own section here AND at the bottom, because the docs said so and we respect the docs ✨)


πŸ¦‹ DESCRIPTION πŸ¦‹

The QColorGroup class contains a group of widget colors.

okay so real talk: a color group is literally a lil bundle of colors that widgets use to draw themselves. And the docs are begging you β€” please, bestie β€” use the symbolic roles like "foreground" and "base" instead of hardcoding literal colors like "red" or "turquoise". The roles are all enumerated and defined down in the ColorRole docs, and you should go read those, they're iconic.

The most common way you'll ever use QColorGroup looks like this:

QPainter p;
...
p.setPen( colorGroup().foreground() );
p.drawLine( ... )

You can also modify color groups, or build brand new ones from scratch. Main character energy either way πŸ’…

There are three different constructors for making one, or you can just take one that Qt hands you and tweak it:

  • the default constructor makes an all-black color group, which you then poke at with the set functions,
  • there's a constructor where you specify all the colors,
  • and there's a copy constructor.
We strongly recommend using a system-supplied color group and modifying that as necessary. Like, seriously. That's the move.

You modify a color group by calling the access functions setColor() and setBrush() β€” pick setColor() if you want a pure color, pick setBrush() if you want a pixmap pattern. 🎨

There are matching getters, color() and brush(), plus a super commonly used convenience function for every single ColorRole: background(), foreground(), base(), etc. It's giving "we thought of everything".

See also QColor, QPalette, QWidget::colorGroup, Widget Appearance and Style, Graphics Classes, and Image Processing Classes.


πŸ’œ Member Type Documentation πŸ’œ

🌟 QColorGroup::ColorRole 🌟

The ColorRole enum defines the different symbolic color roles used in current GUIs. It's basically the cast list of the whole show. Let's meet everyone:

The central roles are:

  • QColorGroup::Background β€” general background color.
  • QColorGroup::Foreground β€” general foreground color.
  • QColorGroup::Base β€” used as background color for text entry widgets, for example; usually white or another light color.
  • QColorGroup::Text β€” the foreground color used with Base. Usually this is the same as the Foreground, in which case it must provide good contrast with Background and Base.
  • QColorGroup::Button β€” general button background color in which buttons need a background different from Background, as in the Macintosh style.
  • QColorGroup::ButtonText β€” a foreground color used with the Button color.

There are some color roles used mostly for 3D bevel and shadow effects:

  • QColorGroup::Light β€” lighter than Button color.
  • QColorGroup::Midlight β€” between Button and Light.
  • QColorGroup::Dark β€” darker than Button.
  • QColorGroup::Mid β€” between Button and Dark.
  • QColorGroup::Shadow β€” a very dark color. By default, the shadow color is Qt::black.

All of these are normally derived from Background 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 Background. (it's giving "everything is connected" ✨)

Selected (marked) items have two roles:

  • QColorGroup::Highlight β€” a color to indicate a selected item or the current item. By default, the highlight color is Qt::darkBlue.
  • QColorGroup::HighlightedText β€” a text color that contrasts with Highlight. By default, the highlighted text color is Qt::white.

Finally, there is a special role for text that needs to be drawn where Text or Foreground would give poor contrast, such as on pressed push buttons:

  • QColorGroup::BrightText β€” a text color that is very different from Foreground and contrasts well with e.g. Dark.
  • QColorGroup::Link β€” a text color used for unvisited hyperlinks. By default, the link color is Qt::blue.
  • QColorGroup::LinkVisited β€” a text color used for already visited hyperlinks. By default, the linkvisited color is Qt::magenta.
  • QColorGroup::NColorRoles β€” Internal.

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. πŸ‘‘

This image shows most of the color roles in use:

[Image Omitted]

πŸ‘‘ MEMBER FUNCTION DOCUMENTATION πŸ‘‘

QColorGroup::QColorGroup ()

Constructs a color group with all colors set to black. πŸ–€

QColorGroup::QColorGroup ( const QColor & foreground, const QColor & background, 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 source working. We strongly advise against using it in new code.

Constructs a color group with the specified colors. The button color will be set to the background color.

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 foreground, button, light, dark, mid, text, bright_text, base and background.

See also QBrush.

QColorGroup::QColorGroup ( const QColorGroup & other )

Constructs a color group that is an independent copy of other. No shared custody, she's fully her own girl πŸ’…

QColorGroup::~QColorGroup ()

Destroys the color group. Rest in peace, bestie πŸ•ŠοΈ

const QColor & QColorGroup::background () const

Returns the background color of the color group.

See also ColorRole.

const QColor & QColorGroup::base () const

Returns the base color of the color group.

See also ColorRole.

const QColor & QColorGroup::brightText () const

Returns the bright text foreground color of the color group.

See also ColorRole.

Examples:

const QBrush & QColorGroup::brush ( ColorRole r ) const

Returns the brush that has been set for color role r.

See also color(), setBrush(), and ColorRole.

Examples:

const QColor & QColorGroup::button () const

Returns the button color of the color group.

See also ColorRole.

Examples:

const QColor & QColorGroup::buttonText () const

Returns the button text foreground color of the color group.

See also ColorRole.

Examples:

const QColor & QColorGroup::color ( ColorRole r ) const

Returns the color that has been set for color role r.

See also brush() and ColorRole.

const QColor & QColorGroup::dark () const

Returns the dark color of the color group.

See also ColorRole.

Example: themes/wood.cpp.

const QColor & QColorGroup::foreground () const

Returns the foreground color of the color group.

See also ColorRole.

Examples:

const QColor & QColorGroup::highlight () const

Returns the highlight color of the color group.

See also ColorRole.

const QColor & QColorGroup::highlightedText () const

Returns the highlighted text color of the color group.

See also ColorRole.

const QColor & QColorGroup::light () const

Returns the light color of the color group.

See also ColorRole.

Example: themes/wood.cpp.

Returns the unvisited link text color of the color group.

See also ColorRole.

const QColor & QColorGroup::linkVisited () const

Returns the visited link text color of the color group.

See also ColorRole.

const QColor & QColorGroup::mid () const

Returns the mid color of the color group.

See also ColorRole.

Examples:

const QColor & QColorGroup::midlight () const

Returns the midlight color of the color group.

See also ColorRole.

bool QColorGroup::operator!= ( const QColorGroup & g ) const

Returns TRUE if this color group is different from g; otherwise returns FALSE.

See also

QColorGroup & QColorGroup::operator= ( const QColorGroup & other )

Copies the colors of other to this color group.

bool QColorGroup::operator== ( const QColorGroup & g ) const

Returns TRUE if this color group is equal to g; otherwise returns FALSE.

See also

void QColorGroup::setBrush ( ColorRole r, const QBrush & b )

Sets the brush used for color role r to b.

See also brush(), setColor(), and ColorRole.

Example: themes/wood.cpp.

void QColorGroup::setColor ( ColorRole r, const QColor & c )

Sets the brush used for color role r to a solid color c.

See also brush() and ColorRole.

Examples:

const QColor & QColorGroup::shadow () const

Returns the shadow color of the color group.

See also ColorRole.

const QColor & QColorGroup::text () const

Returns the text foreground color of the color group.

See also ColorRole.

Example: listviews/listviews.cpp.


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

Writes color group, g to the stream s.

See also Format of the QDataStream operators.


πŸ¦„ SEE ALSO πŸ¦„


Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.


✍️ AUTHOR ✍️

Generated automatically from the source code.


...and that's part 1, bestie β€” more is coming, don't go anywhere πŸ’–

πŸ› BUGS πŸ›

okay bestie, so if you find a bug in Qt (and like… you will, it's software, it's giving human) β€” please report it the way they describe at http://doc.trolltech.com/bughowto.html πŸ’– Good bug reports literally help them help you. Thank you, mwah 🫢

ngl, the definitive Qt documentation is the HTML one, no cap. It lives at $QTDIR/doc/html and you can read it with Qt Assistant or, like, a web browser, whatever vibes you prefer 🌈 This man page? It's just a little convenience for the girlies who prefer man pages β€” lowkey iconic of them to make it, but highkey this format is not officially supported by Trolltech. periodt πŸ’…

And if you spot errors in this man page specifically β€” not Qt itself, just the page β€” please report them to qt-bugs@trolltech.com πŸ“§ and pls pls pls include the name of the manual page (qcolorgroup.3qt) and the Qt version (3.3.8) so they actually know what you're talking about πŸ™ˆ


fr fr though, reporting bugs is main character energy. do it. the maintainers will be obsessed with you ✨

and that's the whole page, babe πŸŽ€ this lil man page came to you courtesy of Trolltech AS, dated 2 February 2007, and it's the man page for QColorGroup(3qt) β€” go forth and colour-group responsibly, queen πŸ‘‘πŸ’œ

πŸ“¦ where this page comes from