Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions | ![]() |
The QBrush class defines the fill pattern of shapes drawn by a QPainter. More...
#include <qbrush.h>
Inherits Qt.
The QBrush class defines the fill pattern of shapes drawn by a QPainter.
A brush has a style and a color. One of the brush styles is a custom pattern, which is defined by a QPixmap.
The brush style defines the fill pattern. The default brush style is NoBrush (depends on how you construct a brush). This style tells the painter to not fill shapes. The standard style for filling is called SolidPattern.
The brush color defines the color of the fill pattern. The QColor documentation lists the predefined colors.
Use the QPen class for specifying line/outline styles.
Example:
QPainter painter; QBrush brush( yellow ); // yellow solid pattern painter.begin( &anyPaintDevice ); // paint something painter.setBrush( brush ); // set the yellow brush painter.setPen( NoPen ); // do not draw outline painter.drawRect( 40,30, 200,100 ); // draw filled rectangle painter.setBrush( NoBrush ); // do not fill painter.setPen( black ); // set black pen, 0 pixel width painter.drawRect( 10,10, 30,20 ); // draw rectangle outline painter.end(); // painting done
See the setStyle() function for a complete list of brush styles.
See also QPainter, QPainter::setBrush(), QPainter::setBrushOrigin(), Graphics Classes, Image Processing Classes and Implicitly and Explicitly Shared Classes.
See also setStyle().
See also setColor() and setStyle().
The color will only have an effect for monochrome pixmaps, i.e., QPixmap::depth() == 1.
See also setColor() and setPixmap().
See also setColor().
Two brushes are different if they have different styles, colors or pixmaps.
See also operator==().
Two brushes are equal if they have equal styles, colors and pixmaps.
See also operator!=().
A null pointer is returned if no custom brush pattern has been set.
See also setPixmap().
See also color() and setStyle().
Example: picture/picture.cpp.
The current brush color will only have an effect for monochrome pixmaps, i.e. QPixmap::depth() == 1.
See also pixmap() and color().
Example: richtext/richtext.cpp.
The brush styles are:
See also style().
See also setStyle().
See also Format of the QDataStream operators.
See also Format of the QDataStream operators.
This file is part of the Qt toolkit, copyright © 1995-2001 Trolltech, all rights reserved.
Copyright © 2001 Trolltech | Trademarks | Qt version 3.0.0-beta4
|