⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qcolor.3qt

📁 linux下GUI编程工具qt的在线连接帮助手册
💻 3QT
📖 第 1 页 / 共 2 页
字号:
.PPReturns a darker color if \fIfactor\fR is greater than 100. Setting \fIfactor\fR to 300 returns a color that has one-third the brightness..PPReturns a lighter color if \fIfactor\fR is less than 100. We recommend using lighter() for this purpose. If \fIfactor\fR is 0 or negative, the return value is unspecified..PP(This function converts the current RGB color to HSV, divides V by \fIfactor\fR and converts back to RGB.).PPSee also light()..PPExamples:.)l desktop/desktop.cpp and themes/wood.cpp..SH "void QColor::destroyAllocContext ( int context )\fC [static]\fR"Destroys a color allocation context, \fIcontext\fR..PPThis function deallocates all colors that were allocated in the specified \fIcontext\fR. If \fIcontext\fR == -1, it frees up all colors that the application has allocated. If \fIcontext\fR == -2, it frees up all colors that the application has allocated, except those in the default context..PPThe function does nothing for true color displays..PPSee also enterAllocContext() and alloc()..PPExample: showimg/showimg.cpp..SH "int QColor::enterAllocContext ()\fC [static]\fR"Enters a color allocation context and returns a nonzero unique identifier..PPColor allocation contexts are useful for programs that need to allocate many colors and throw them away later, like image viewers. The allocation context functions work for true color displays as well as colormap display, except that QColor::destroyAllocContext() does nothing for true color..PPExample:.PP.nf.br    QPixmap loadPixmap( QString fileName ).br    {.br        static int alloc_context = 0;.br        if ( alloc_context ).br            QColor::destroyAllocContext( alloc_context );.br        alloc_context = QColor::enterAllocContext();.br        QPixmap pm( fileName );.br        QColor::leaveAllocContext();.br        return pm;.br    }.br.fi.PPThe example code loads a pixmap from file. It frees up all colors that were allocated the last time loadPixmap() was called..PPThe initial/default context is 0. Qt keeps a list of colors associated with their allocation contexts. You can call destroyAllocContext() to get rid of all colors that were allocated in a specific context..PPCalling enterAllocContext() enters an allocation context. The allocation context lasts until you call leaveAllocContext(). QColor has an internal stack of allocation contexts. Each call to enterAllocContex() must have a corresponding leaveAllocContext()..PP.nf.br      // context 0 active.br    int c1 = QColor::enterAllocContext();       // enter context c1.br      // context c1 active.br    int c2 = QColor::enterAllocContext();       // enter context c2.br      // context c2 active.br    QColor::leaveAllocContext();                // leave context c2.br      // context c1 active.br    QColor::leaveAllocContext();                // leave context c1.br      // context 0 active.br      // Now, free all colors that were allocated in context c2.br    QColor::destroyAllocContext( c2 );.br.fi.PPYou may also want to set the application's color specification. See QApplication::setColorSpec() for more information..PPSee also leaveAllocContext(), currentAllocContext(), destroyAllocContext() and QApplication::setColorSpec()..PPExample: showimg/showimg.cpp..SH "void QColor::getHsv ( int & h, int & s, int & v ) const"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..SH "int QColor::green () const"Returns the G (green) component of the RGB value..SH "void QColor::hsv ( int * h, int * s, int * v ) const"Returns the current RGB value as HSV. The contents of the \fIh\fR, \fIs\fR and \fIv\fR pointers are set to the HSV values. If any of the three pointers are null, the function does nothing..PPThe hue (which \fIh\fR points to) is set to -1 if the color is achromatic..PPSee also setHsv() and rgb()..PPExample: themes/metal.cpp..SH "void QColor::initialize ()\fC [static]\fR"Internal initialization required for QColor. This function is called from the QApplication constructor..PPSee also cleanup()..SH "bool QColor::isValid () const"Returns FALSE if the color is invalid, i.e., it was constructed using the default constructor..PPUse of this function is discouraged, as it is slightly slow on Truecolor displays. If you need a "null" QColor, it may be better to use q QColor* where possible..PPExample: scribble/scribble.cpp..SH "void QColor::leaveAllocContext ()\fC [static]\fR"Leaves a color allocation context..PPSee enterAllocContext() for a detailed explanation..PPSee also enterAllocContext() and currentAllocContext()..PPExample: showimg/showimg.cpp..SH "QColor QColor::light ( int factor = 150 ) const"Returns a lighter (or darker) color, but does not change this object..PPReturns a lighter color if \fIfactor\fR is greater than 100. Setting \fIfactor\fR to 150 returns a color that is 50% brighter..PPReturns a darker color if \fIfactor\fR is less than 100. We recommend using dark() for this purpose. If \fIfactor\fR is 0 or negative, the return value is unspecified..PP(This function converts the current RGB color to HSV, multiplies V by \fIfactor\fR, and converts the result back to RGB.).PPSee also dark()..PPExamples:.)l desktop/desktop.cpp and themes/wood.cpp..SH "int QColor::maxColors ()\fC [static]\fR"Returns the maximum number of colors supported by the underlying window system..SH "QString QColor::name () const"Returns the name of the color in the format "#RRGGBB", i.e., a" #" character followed by three two-digit hexadecimal numbers..PPSee also setNamedColor()..SH "int QColor::numBitPlanes ()\fC [static]\fR"Returns the number of color bit planes for the underlying window system..PPThe returned values is equal to the default pixmap depth;.PPSee also QPixmap::defaultDepth()..SH "bool QColor::operator!= ( const QColor & c ) const"Returns TRUE if this color has a different RGB value from \fIc\fR, or FALSE if they have equal RGB values..SH "QColor & QColor::operator= ( const QColor & c )"Assigns a copy of the color \fIc\fR and returns a reference to this color..SH "bool QColor::operator== ( const QColor & c ) const"Returns TRUE if this color has the same RGB value as \fIc\fR, or FALSE if they have different RGB values..SH "uint QColor::pixel () const"Returns the pixel value..PPThis value is used by the underlying window system to refer to a color. It can be thought of as an index into the display hardware's color table, but the value is an arbitrary 32-bit value..PPSee also alloc()..SH "int QColor::red () const"Returns the R (red) component of the RGB value..SH "void QColor::rgb ( int * r, int * g, int * b ) const"Sets the contents pointed to by \fIr\fR, \fIg\fR and \fIb\fR to the red, green and blue components of the RGB value respectively. The value range for a component is 0..255..PPSee also setRgb() and hsv()..SH "QRgb QColor::rgb () const"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns the RGB value..PPThe return type \fIQRgb\fR is equivalent to \fCunsigned\fR \fCint\fR..PPFor an invalid color, the alpha value of the returned valud is unspecified..PPSee also setRgb(), hsv(), qRed(), qBlue(), qGreen() and isValid()..SH "void QColor::setHsv ( int h, int s, int v )"Sets a HSV color value. \fIh\fR is the hue, \fIs\fR is the saturation and \fIv\fR is the value of the HSV color..PPIf \fIs\fR or \fIv\fR are not in the range 0-255, or \fIh\fR is < -1, the color is not changed..PPSee also hsv() and setRgb()..PPExamples:.)l drawdemo/drawdemo.cpp, grapher/grapher.cpp and progress/progress.cpp..SH "void QColor::setNamedColor ( const QString & name )"Sets the RGB value to \fIname\fR, which may be in one of these formats:.TP#RGB (each of R, G and B is a single hex digit).TP#RRGGBB.TP#RRRGGGBBB.TP#RRRRGGGGBBBB.TPA name from the X color database (rgb.txt) (e.g." steelblue" or "gainsboro"). These color names also work under Qt for Windows..PPThe color is left invalid if \fIname\fR cannot be parsed..SH "void QColor::setRgb ( int r, int g, int b )"Sets the RGB value to \fIr\fR, \fIg\fR, \fIb\fR. The arguments, \fIr\fR, \fIg\fR and \fIb\fR must all be in the range 0..255. If any of them are outside the legal range, the color is not changed..PPSee also rgb() and setHsv()..SH "void QColor::setRgb ( QRgb rgb )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPSets the RGB value to \fIrgb\fR..PPThe type \fIQRgb\fR is equivalent to \fCunsigned\fR \fCint\fR..PPSee also rgb() and setHsv()..SH RELATED FUNCTION DOCUMENTATION.SH "QDataStream & operator<< ( QDataStream & s, const QColor & c )"Writes a color object, \fIc\fR to the stream, \fIs\fR..PPSee also Format of the QDataStream operators..SH "QDataStream & operator>> ( QDataStream & s, QColor & c )"Reads a color object, \fIc\fR, from the stream, \fIs\fR..PPSee also Format of the QDataStream operators..SH "int qAlpha ( QRgb rgba )"Returns the alpha component of the RGBA quadruplet \fIrgba\fR..SH "int qBlue ( QRgb rgb )"Returns the blue component of the RGB triplet \fIrgb\fR..PPSee also qRgb() and QColor::blue()..SH "int qGray ( int r, int g, int b )"Returns a gray value 0..255 from the (\fIr\fR, \fIg\fR, \fIb\fR) triplet..PPThe gray value is calculated using the formula (r*11 + g*16 + b*5)/32..SH "int qGray ( qRgb rgb )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns a gray value 0..255 from the given \fIrgb\fR colour..SH "int qGreen ( QRgb rgb )"Returns the green component of the RGB triplet \fIrgb\fR..PPSee also qRgb() and QColor::green()..SH "int qRed ( QRgb rgb )"Returns the red component of the RGB triplet \fIrgb\fR..PPSee also qRgb() and QColor::red()..SH "QRgb qRgb ( int r, int g, int b )"Returns the RGB triplet \fI(r,g,b)\fR..PPThe return type QRgb is equivalent to \fCunsigned\fR \fCint\fR..PPSee also qRgba(), qRed(), qGreen() and qBlue()..SH "QRgb qRgba ( int r, int g, int b, int a )"Returns the RGBA quadruplet \fI(r,g,b,a)\fR..PPThe return type QRgba is equivalent to \fCunsigned\fR \fCint\fR..PPSee also qRgb(), qRed(), qGreen() and qBlue()..SH "SEE ALSO".BR http://doc.trolltech.com/qcolor.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com.  See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qcolor.3qt) and the Qtversion (3.0.0).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -