📄 qcolorgroup.3qt
字号:
.TH QColorGroup 3qt "10 November 2000" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2000 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQColorGroup \- Group of widget colors.SH SYNOPSIS.br.PP\fC#include <qpalette.h>\fR.PP.SS "Public Members".in +1c.ti -1c.BI "\fBQColorGroup\fR () ".br.ti -1c.BI "QColorGroup ( const QColor & " "foreground" ", const QColor & " "button" ", const QColor & " "light" ", const QColor & " "dark" ", const QColor & " "mid" ", const QColor & " "text" ", const QColor & base ) \fI(obsolete)\fR".br.ti -1c.BI "\fBQColorGroup\fR ( 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 ) ".br.ti -1c.BI "\fBQColorGroup\fR ( const QColorGroup & ) ".br.ti -1c.BI "\fB~QColorGroup\fR () ".br.ti -1c.BI "enum \fBColorRole\fR { Foreground, Button, Light, Midlight, Dark, Mid, Text, BrightText, ButtonText, Base, Background, Shadow, Highlight, HighlightedText, NColorRoles }".br.ti -1c.BI "const QColor& \fBcolor\fR ( ColorRole ) const".br.ti -1c.BI "const QBrush& \fBbrush\fR ( ColorRole ) const".br.ti -1c.BI "void \fBsetColor\fR ( ColorRole, const QColor & ) ".br.ti -1c.BI "void \fBsetBrush\fR ( ColorRole, const QBrush & ) ".br.ti -1c.BI "const QColor& \fBforeground\fR () const".br.ti -1c.BI "const QColor& \fBbutton\fR () const".br.ti -1c.BI "const QColor& \fBlight\fR () const".br.ti -1c.BI "const QColor& \fBdark\fR () const".br.ti -1c.BI "const QColor& \fBmid\fR () const".br.ti -1c.BI "const QColor& \fBtext\fR () const".br.ti -1c.BI "const QColor& \fBbase\fR () const".br.ti -1c.BI "const QColor& \fBbackground\fR () const".br.ti -1c.BI "const QColor& \fBmidlight\fR () const".br.ti -1c.BI "const QColor& \fBbrightText\fR () const".br.ti -1c.BI "const QColor& \fBbuttonText\fR () const".br.ti -1c.BI "const QColor& \fBshadow\fR () const".br.ti -1c.BI "const QColor& \fBhighlight\fR () const".br.ti -1c.BI "const QColor& \fBhighlightedText\fR () const".br.ti -1c.BI "bool \fBoperator==\fR ( const QColorGroup & g ) const".br.ti -1c.BI "bool \fBoperator!=\fR ( const QColorGroup & g ) const".br.in -1c.SH RELATED FUNCTION DOCUMENTATION(Note that these are not member functions.).in +1c.ti -1c.BI "QDataStream & \fBoperator>>\fR (QDataStream & " "s" ", QColorGroup & " "g" ")".br.ti -1c.BI "QDataStream & \fBoperator<<\fR (QDataStream & " "s" ", const QColorGroup & " "g" ")".br.in -1c.SH DESCRIPTIONThe QColorGroup class contains a group of widget colors..PPA 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. The color roles are enumerated and defined in the ColorRole documentation..PPThe most common usage of QColorGroup is like this:.PP.nf.br QPainter p;.br ....br p.setPen( colorGroup().foreground() );.br p.drawLine( ... ).fi.PPSee the ColorRole documentation below for more details on roles..PPIt's also possible to modify color groups or create them from scratch..PPThe color group class can be created using three different constructors, or by modifying one supplied by the system. The default constructor creates an all-black color group, which can then be modified using set functions. There are two functions that take long lists of arguments (slightly different lists - beware!). And there is the copy constructor..PPWe strongly recommend using a system-supplied color group, and modifying that as necessary..PPYou modify a color group by calling the access functions setColor() and setBrush(), depending on whether you want a pure color or e.g. a pixmap pattern..PPThere are also corresponding color() and brush() getters, and a commonly used convenience function to get each ColorRole: background(), foreground(), base() and so on..PPSee also QColor, QPalette and QWidget::colorGroup()..SS "Member Type Documentation".SH "QColorGroup::ColorRole"The ColorRole enum defines the different symbolic color roles used in current GUIs. The central roles are:.TP\fCBackground\fR - general background color..TP\fCForeground\fR - general foreground color..TP\fCBase\fR - used as background color for e.g. text entry widgets, usually white or another light color..TP\fCText\fR - the foreground color used with \fCBase.\fR Usually this is the same as the \fCForeground,\fR in what case it must provide good contrast both with \fCBackground\fR and \fCBase.\fR.TP\fCButton\fR - general button background color, where buttons need a background different from \fCBackground,\fR as in the Macintosh style..TP\fCButtonText\fR - a foreground color used with the \fCButton\fR color..IPThere are some color roles used mostly for 3D bevel and shadow effects: .TP\fCLight\fR - lighter than \fCButton\fR color..TP\fCMidlight\fR - between \fCButton\fR and \fCLight.\fR.TP\fCDark\fR - darker than \fCButton.\fR.TP\fCMid\fR - between \fCButton\fR and \fCDark.\fR.TP\fCShadow\fR - a very dark color..IPAll of these are normally derived from \fCBackground,\fR and used in ways that depend on that relationship. For example, buttons depend on it to make the bevels look good, and Motif scroll bars depend on \fCMid\fR to be slightly different from \fCBackground.\fR.PPSelected (marked) items have two roles: .TP\fCHighlight\fR - a color to indicate a selected or highlighted item..TP\fCHighlightedText\fR - a text color that contrasts to \fCHighlight.\fR.IPFinally, there is a special role for text that needs to be drawn where \fCText\fR or \fCForeground\fR would provide bad contrast, such as on pressed push buttons: .TP\fCBrightText\fR - a text color that is very different from \fCForeground\fR and contrasts well with e.g. \fCDark.\fR.IP.PPNote that text colors can be used for other things than just words: text colors are \fIusually\fR used for text, but it's quite common to have lines, icons and so on that belong with a text color logically..PPThis image shows most of the color roles in use: <img src="palette.png" width="603" height="166" alt="">.SH MEMBER FUNCTION DOCUMENTATION.SH "QColorGroup::QColorGroup ()"Constructs a color group with all colors set to black..SH "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..PPThis constructor can be very handy sometimes, but don't overuse it: Such long lists of arguments are rather error-prone..PPSee also QBrush..SH "QColorGroup::QColorGroup ( const QColor & foreground, const QColor & background, const QColor & light, const QColor & dark, const QColor & mid, const QColor & text, const QColor & base )"\fBThis function is obsolete.\fR It is provided to keep old source working, and will probably be removed in a future version of Qt. We strongly advise against using it in new code..PPConstructs a color group with the specified colors. The button color will be set to the background color..SH "QColorGroup::QColorGroup ( const QColorGroup & other )"Constructs a color group that is an independent copy of \fIother.\fR.SH "QColorGroup::~QColorGroup ()"Destructs the color group..SH "const QColor & QColorGroup::background () const"Returns the background color of the color group..PPSee also ColorRole..SH "const QColor & QColorGroup::base () const"Returns the base color of the color group..PPSee also ColorRole..SH "const QColor & QColorGroup::brightText () const"Returns the bright text foreground color of the color group..PPSee also ColorRole..SH "const QBrush & QColorGroup::brush ( ColorRole r ) const"Returns the brush that has been set for color role \fIr.\fR.PPSee also color(), setBrush() and ColorRole..SH "const QColor & QColorGroup::button () const"Returns the button color of the color group..PPSee also ColorRole..SH "const QColor & QColorGroup::buttonText () const"Returns the button text foreground color of the color group..PPSee also ColorRole..SH "const QColor & QColorGroup::color ( ColorRole r ) const"Returns the color that has been set for color role \fIr.\fR.PPSee also brush() and ColorRole..SH "const QColor & QColorGroup::dark () const"Returns the dark color of the color group..PPSee also ColorRole..SH "const QColor & QColorGroup::foreground () const"Returns the foreground color of the color group..PPSee also ColorRole..SH "const QColor & QColorGroup::highlight () const"Returns the highlight color of the color group..PPSee also ColorRole..SH "const QColor & QColorGroup::highlightedText () const"Returns the highlighted text color of the color group..PPSee also ColorRole..SH "const QColor & QColorGroup::light () const"Returns the light color of the color group..PPSee also ColorRole..SH "const QColor & QColorGroup::mid () const"Returns the medium color of the color group..PPSee also ColorRole..SH "const QColor& QColorGroup::midlight () const"Returns the midlight color of the color group..PPSee also ColorRole..SH "bool QColorGroup::operator!= ( const QColorGroup & g ) const"Returns TRUE if this color group is different from \fIg,\fR or FALSE if it is equal to \fIg.\fR.PPSee also operator!=()..SH "bool QColorGroup::operator== ( const QColorGroup & g ) const"Returns TRUE if this color group is equal to \fIg,\fR or FALSE if it is different from \fIg.\fR.PPSee also operator==()..SH "void QColorGroup::setBrush ( ColorRole r, const QBrush & b )"Sets the brush used for color role \fIr\fR to \fIb.\fR.PPSee also brush(), setColor() and ColorRole..SH "void QColorGroup::setColor ( ColorRole r, const QColor & c )"Sets the brush used for color role \fIr\fR to a solid color \fIc.\fR.PPSee also brush(), setColor() and ColorRole..SH "const QColor & QColorGroup::shadow () const"Returns the shadow color of the color group..PPSee also ColorRole..SH "const QColor & QColorGroup::text () const"Returns the text foreground color of the color group..PPSee also ColorRole..SH RELATED FUNCTION DOCUMENTATION.SH "QDataStream & operator>> (QDataStream & s, QColorGroup & g)"Reads a color group from the stream..PPSee also Format of the QDataStream operators.SH "QDataStream & operator<< (QDataStream & s, const QColorGroup & g)"Writes a color group to the stream..PPSee also Format of the QDataStream operators.SH "SEE ALSO".BR http://doc.trolltech.com/qcolorgroup.html.SH COPYRIGHTCopyright 1992-2000 Trolltech AS, http://www.trolltech.com/. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -