QPalette Class Reference |
Constant | Value | Description |
---|---|---|
QPalette::Disabled | 1 | |
QPalette::Active | 0 | |
QPalette::Inactive | 2 | |
QPalette::Normal | Active | synonym for Active |
The ColorRole enum defines the different symbolic color roles used in current GUIs.
The central roles are:
Constant | Value | Description |
---|---|---|
QPalette::Window | 10 | A general background color. |
QPalette::Background | Window | This value is obsolete. Use Window instead. |
QPalette::WindowText | 0 | A general foreground color. |
QPalette::Foreground | WindowText | This value is obsolete. Use WindowText instead. |
QPalette::Base | 9 | Used as the background color for text entry widgets; usually white or another light color. |
QPalette::AlternateBase | 16 | Used as the alternate background color in views with alternating row colors (see QAbstractItemView::setAlternatingRowColors()). |
QPalette::Text | 6 | 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. |
QPalette::Button | 1 | The general button background color. This background can be different from Window as some styles require a different background color for buttons. |
QPalette::ButtonText | 8 | A foreground color used with the Button color. |
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.
Constant | Value | Description |
---|---|---|
QPalette::Light | 2 | Lighter than Button color. |
QPalette::Midlight | 3 | Between Button and Light. |
QPalette::Dark | 4 | Darker than Button. |
QPalette::Mid | 5 | Between Button and Dark. |
QPalette::Shadow | 11 | A very dark color. By default, the shadow color is Qt::black. |
Selected (marked) items have two roles:
Constant | Value | Description |
---|---|---|
QPalette::Highlight | 12 | A color to indicate a selected item or the current item. By default, the highlight color is Qt::darkBlue. |
QPalette::HighlightedText | 13 | 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. 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.
Constant | Value | Description |
---|---|---|
QPalette::BrightText | 7 | A text color that is very different from Foreground, and contrasts well with e.g. Dark. |
QPalette::Link | 14 | A text color used for unvisited hyperlinks. By default, the link color is Qt::blue. |
QPalette::LinkVisited | 15 | A text color used for already visited hyperlinks. By default, the linkvisited color is Qt::magenta. |
This image shows most of the color roles in use:
Constructs a palette object that uses the application's default palette.
See also QApplication::setPalette() and QApplication::palette().
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.
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.
Constructs a palette from a button color and a window. The other colors are automatically calculated, based on these colors.
Constructs a palette. You can pass either brushes, pixmaps or plain colors for windowText, button, light, dark, mid, text, bright_text, base and window.
See also QBrush.
Constructs a copy of p.
This constructor is fast because of implicit sharing.
Destroys the palette.
Returns the alternate base brush of the current color group.
See also ColorRole and brush().
Returns the base brush of the current color group.
See also ColorRole and brush().
Returns the bright text foreground brush of the current color group.
See also ColorRole and brush().
Returns the brush in color group gr, used for color role cr.
See also color(), setBrush(), and ColorRole.
This is an overloaded member function, provided for convenience.
Returns the brush that has been set for color role r in the current ColorGroup.
See also color(), setBrush(), and ColorRole.
Returns the button brush of the current color group.
See also ColorRole and brush().
Returns the button text foreground brush of the current color group.
See also ColorRole and brush().
Returns the color in color group gr, used for color role r.
See also brush(), setColor(), and ColorRole.
This is an overloaded member function, provided for convenience.
Returns the color that has been set for color role r in the current ColorGroup.
See also brush() and ColorRole.
Returns the palette's current color group.
See also setCurrentColorGroup().
Returns the dark brush of the current color group.
See also ColorRole and brush().
Returns the highlight brush of the current color group.
See also ColorRole and brush().
Returns the highlighted text brush of the current color group.
See also ColorRole and brush().
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.
See also operator=() and operator==().
Returns true (usually quickly) if color group cg1 is equal to cg2; otherwise returns false.
Returns the light brush of the current color group.
See also ColorRole and brush().
Returns the unvisited link text brush of the current color group.
See also ColorRole and brush().
Returns the visited link text brush of the current color group.
See also ColorRole and brush().
Returns the mid brush of the current color group.
See also ColorRole and brush().
Returns the midlight brush of the current color group.
See also ColorRole and brush().
Returns a new QPalette that has attributes copied from other.
Returns a number that uniquely identifies this QPalette object. The serial number is intended for caching. Its value may not be used for anything other than equality testing.
Note that QPalette uses implicit sharing, and the serial number changes during the lazy copy operation (when the palette is actually modified), not during a shallow copy (copy constructor or assignment).
See also QPixmap, QPixmapCache, and QCache.
Sets the brush for color role cr to brush brush for all groups in the palette.
See also brush(), setColor(), and ColorRole.
This is an overloaded member function, provided for convenience.
Sets the brush in color group cg, used for color role cr, to b.
See also brush(), setColor(), and ColorRole.
Sets the brush in color group gr, used for color role r, to the solid color c.
See also setBrush(), color(), and ColorRole.
This is an overloaded member function, provided for convenience.
Sets the color used for color role r in all color groups to a solid color c.
See also brush(), setColor(), and ColorRole.
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.
See also QBrush.
Set the palette's current color group to cg.
See also currentColorGroup().
Returns the shadow brush of the current color group.
See also ColorRole and brush().
Returns the text foreground brush of the current color group.
See also ColorRole and brush().
Returns the window (general background) brush of the current color group.
See also ColorRole and brush().
Returns the window text (general foreground) brush of the current color group.
See also ColorRole and brush().
Returns the palette as a QVariant
Returns true (slowly) if this palette is different from p; otherwise returns false (usually quickly).
Assigns p to this palette and returns a reference to this palette.
This operation is fast because of implicit sharing.
Returns true (usually quickly) if this palette is equal to p; otherwise returns false (slowly).
This is an overloaded member function, provided for convenience.
Writes the palette, p to the stream s and returns a reference to the stream.
See also Format of the QDataStream operators.
This is an overloaded member function, provided for convenience.
Reads a palette from the stream, s into the palette p, and returns a reference to the stream.
See also Format of the QDataStream operators.
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 4.1 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com