You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tqt3/doc/man/man3/qbrush.3qt

235 lines
7.6 KiB

'\" t
.TH QBrush 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QBrush \- Defines the fill pattern of shapes drawn by a QPainter
.SH SYNOPSIS
\fC#include <qbrush.h>\fR
.PP
Inherits Qt.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQBrush\fR ()"
.br
.ti -1c
.BI "\fBQBrush\fR ( BrushStyle style )"
.br
.ti -1c
.BI "\fBQBrush\fR ( const QColor & color, BrushStyle style = SolidPattern )"
.br
.ti -1c
.BI "\fBQBrush\fR ( const QColor & color, const QPixmap & pixmap )"
.br
.ti -1c
.BI "\fBQBrush\fR ( const QBrush & b )"
.br
.ti -1c
.BI "\fB~QBrush\fR ()"
.br
.ti -1c
.BI "QBrush & \fBoperator=\fR ( const QBrush & b )"
.br
.ti -1c
.BI "BrushStyle \fBstyle\fR () const"
.br
.ti -1c
.BI "void \fBsetStyle\fR ( BrushStyle s )"
.br
.ti -1c
.BI "const QColor & \fBcolor\fR () const"
.br
.ti -1c
.BI "void \fBsetColor\fR ( const QColor & c )"
.br
.ti -1c
.BI "QPixmap * \fBpixmap\fR () const"
.br
.ti -1c
.BI "void \fBsetPixmap\fR ( const QPixmap & pixmap )"
.br
.ti -1c
.BI "bool \fBoperator==\fR ( const QBrush & b ) const"
.br
.ti -1c
.BI "bool \fBoperator!=\fR ( const QBrush & b ) const"
.br
.in -1c
.SH RELATED FUNCTION DOCUMENTATION
.in +1c
.ti -1c
.BI "QDataStream & \fBoperator<<\fR ( QDataStream & s, const QBrush & b )"
.br
.ti -1c
.BI "QDataStream & \fBoperator>>\fR ( QDataStream & s, QBrush & b )"
.br
.in -1c
.SH DESCRIPTION
The QBrush class defines the fill pattern of shapes drawn by a QPainter.
.PP
A brush has a style and a color. One of the brush styles is a custom pattern, which is defined by a QPixmap.
.PP
The brush style defines the fill pattern. The default brush style is NoBrush (depending on how you construct a brush). This style tells the painter to not fill shapes. The standard style for filling is SolidPattern.
.PP
The brush color defines the color of the fill pattern. The QColor documentation lists the predefined colors.
.PP
Use the QPen class for specifying line/outline styles.
.PP
Example:
.PP
.nf
.br
QPainter painter;
.br
QBrush brush( yellow ); // yellow solid pattern
.br
painter.begin( &anyPaintDevice ); // paint something
.br
painter.setBrush( brush ); // set the yellow brush
.br
painter.setPen( NoPen ); // do not draw outline
.br
painter.drawRect( 40,30, 200,100 ); // draw filled rectangle
.br
painter.setBrush( NoBrush ); // do not fill
.br
painter.setPen( black ); // set black pen, 0 pixel width
.br
painter.drawRect( 10,10, 30,20 ); // draw rectangle outline
.br
painter.end(); // painting done
.br
.fi
.PP
See the setStyle() function for a complete list of brush styles.
.PP
<center>
.ce 1
.B "[Image Omitted]"
.PP
</center>
.PP
See also QPainter, QPainter::setBrush(), QPainter::setBrushOrigin(), Graphics Classes, Image Processing Classes, and Implicitly and Explicitly Shared Classes.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QBrush::QBrush ()"
Constructs a default black brush with the style NoBrush (will not fill shapes).
.SH "QBrush::QBrush ( BrushStyle style )"
Constructs a black brush with the style \fIstyle\fR.
.PP
See also setStyle().
.SH "QBrush::QBrush ( const QColor & color, BrushStyle style = SolidPattern )"
Constructs a brush with the color \fIcolor\fR and the style \fIstyle\fR.
.PP
See also setColor() and setStyle().
.SH "QBrush::QBrush ( const QColor & color, const QPixmap & pixmap )"
Constructs a brush with the color \fIcolor\fR and a custom pattern stored in \fIpixmap\fR.
.PP
The color will only have an effect for monochrome pixmaps, i.e. for QPixmap::depth() == 1.
.PP
Pixmap brushes are currently not supported when printing on X11.
.PP
See also setColor() and setPixmap().
.SH "QBrush::QBrush ( const QBrush & b )"
Constructs a brush that is a shallow copy of \fIb\fR.
.SH "QBrush::~QBrush ()"
Destroys the brush.
.SH "const QColor & QBrush::color () const"
Returns the brush color.
.PP
See also setColor().
.SH "bool QBrush::operator!= ( const QBrush & b ) const"
Returns TRUE if the brush is different from \fIb\fR; otherwise returns FALSE.
.PP
Two brushes are different if they have different styles, colors or pixmaps.
.PP
See also operator==().
.SH "QBrush & QBrush::operator= ( const QBrush & b )"
Assigns \fIb\fR to this brush and returns a reference to this brush.
.SH "bool QBrush::operator== ( const QBrush & b ) const"
Returns TRUE if the brush is equal to \fIb\fR; otherwise returns FALSE.
.PP
Two brushes are equal if they have equal styles, colors and pixmaps.
.PP
See also operator!=().
.SH "QPixmap * QBrush::pixmap () const"
Returns a pointer to the custom brush pattern, or 0 if no custom brush pattern has been set.
.PP
See also setPixmap().
.PP
Example: richtext/richtext.cpp.
.SH "void QBrush::setColor ( const QColor & c )"
Sets the brush color to \fIc\fR.
.PP
See also color() and setStyle().
.PP
Example: picture/picture.cpp.
.SH "void QBrush::setPixmap ( const QPixmap & pixmap )"
Sets the brush pixmap to \fIpixmap\fR. The style is set to CustomPattern.
.PP
The current brush color will only have an effect for monochrome pixmaps, i.e. for QPixmap::depth() == 1.
.PP
Pixmap brushes are currently not supported when printing on X11.
.PP
See also pixmap() and color().
.PP
Example: richtext/richtext.cpp.
.SH "void QBrush::setStyle ( BrushStyle s )"
Sets the brush style to \fIs\fR.
.PP
The brush styles are: <center>.nf
.TS
l - l. Pattern Meaning NoBrush will not fill shapes (default). SolidPattern solid (100%) fill pattern. Dense1Pattern 94% fill pattern. Dense2Pattern 88% fill pattern. Dense3Pattern 63% fill pattern. Dense4Pattern 50% fill pattern. Dense5Pattern 37% fill pattern. Dense6Pattern 12% fill pattern. Dense7Pattern 6% fill pattern. HorPattern horizontal lines pattern. VerPattern vertical lines pattern. CrossPattern crossing lines pattern. BDiagPattern diagonal lines (directed /) pattern. FDiagPattern diagonal lines (directed &#92;) pattern. DiagCrossPattern diagonal crossing lines pattern. CustomPattern
.TE
.fi
</center>
.PP
On Windows, dense and custom patterns cannot be transparent.
.PP
See the Detailed Description for a picture of all the styles.
.PP
See also style().
.SH "BrushStyle QBrush::style () const"
Returns the brush style.
.PP
See also setStyle().
.SH RELATED FUNCTION DOCUMENTATION
.SH "QDataStream & operator<< ( QDataStream & s, const QBrush & b )"
Writes the brush \fIb\fR to the stream \fIs\fR and returns a reference to the stream.
.PP
See also Format of the QDataStream operators.
.SH "QDataStream & operator>> ( QDataStream & s, QBrush & b )"
Reads the brush \fIb\fR from the stream \fIs\fR and returns a reference to the stream.
.PP
See also Format of the QDataStream operators.
.SH "SEE ALSO"
.BR http://doc.trolltech.com/qbrush.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If 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.
.P
The definitive Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (qbrush.3qt) and the Qt
version (3.3.8).