QBrush(3qt)
πΈ QBrush β bestie, this is literally the glow-up for your shapes πΈ
okay so this is the QBrush(3qt) page from the Qt 3 docs (yep, the man page is called qbrush.3qt, iykyk) and it's all about how you fill stuff in. no cap, it's giving art class but make it code π¨β¨
π NAME π
QBrush β defines the fill pattern of shapes drawn by a QPainter. that's it, that's the vibe. ποΈ
β¨ SYNOPSIS β¨
#include <qbrush.h>
Inherits Qt.
π«Ά Public Members π«Ά
QBrush ()
QBrush ( BrushStyle style )
QBrush ( const QColor & color, BrushStyle style = SolidPattern )
QBrush ( const QColor & color, const QPixmap & pixmap )
QBrush ( const QBrush & b )
~QBrush ()
QBrush & operator= ( const QBrush & b )
BrushStyle style () const
void setStyle ( BrushStyle s )
const QColor & color () const
void setColor ( const QColor & c )
QPixmap * pixmap () const
void setPixmap ( const QPixmap & pixmap )
bool operator== ( const QBrush & b ) const
bool operator!= ( const QBrush & b ) const
π RELATED FUNCTION DOCUMENTATION π
QDataStream & operator<< ( QDataStream & s, const QBrush & b )
QDataStream & operator>> ( QDataStream & s, QBrush & b )
π DESCRIPTION π
The QBrush class defines the fill pattern of shapes drawn by a QPainter. so likeβ¦ pens do the outlines, brushes do the fills. the two leads of your drawing drama. π
A brush has a style and a color. and one of the brush styles is a custom pattern, which is defined by a QPixmap. cute, right? you can literally paint with a picture. π¦
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. so like, default = no fill, and if you actually want fill, you go SolidPattern. noted, bestie. π
The brush color defines the color of the fill pattern. The QColor documentation lists the predefined colors. go look, there's a whole palette of them. π
Use the QPen class for specifying line/outline styles. brush = fill, pen = outline. don't mix them up or it's gonna be a mess fr fr. βοΈ
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.
<center> [Image Omitted]
</center>
See also QPainter, QPainter::setBrush(), QPainter::setBrushOrigin(), Graphics Classes, Image Processing Classes, and Implicitly and Explicitly Shared Classes.
π MEMBER FUNCTION DOCUMENTATION π
π QBrush::QBrush () π
Constructs a default black brush with the style NoBrush (will not fill shapes). so it exists, it's black, and it does absolutely nothing to your shapes. iconic behaviour honestly. π
π QBrush::QBrush ( BrushStyle style ) π
Constructs a black brush with the style style. black by default, but you picked the pattern.
See also setStyle().
π QBrush::QBrush ( const QColor & color, BrushStyle style = SolidPattern ) π
Constructs a brush with the color color and the style style. this is the classic combo, the main character constructor. π β¨
See also setColor() and setStyle().
π QBrush::QBrush ( const QColor & color, const QPixmap & pixmap ) π
Constructs a brush with the color color and a custom pattern stored in pixmap.
The color will only have an effect for monochrome pixmaps, i.e. for QPixmap::depth() == 1. so like, unless your pixmap is literally 1-bit monochrome, the color is just there vibing and doing nothing. π
Pixmap brushes are currently not supported when printing on X11. heads up bestie, this one will not work if you're printing on X11. not a drill. π¨
See also setColor() and setPixmap().
π QBrush::QBrush ( const QBrush & b ) π
Constructs a brush that is a shallow copy of b. shallow, not deep. the copy is linked to the original's data, that's just how it is. πͺ
π QBrush::~QBrush () π
Destroys the brush. bye bestie, thank you for your service. π«Άπ
π const QColor & QBrush::color () const π
Returns the brush color. gimme the color.
See also setColor().
π bool QBrush::operator!= ( const QBrush & b ) const π
Returns TRUE if the brush is different from b; otherwise returns FALSE.
Two brushes are different if they have different styles, colors or pixmaps. so any one of those three being off = not equal. no partial credit. π€
See also operator==().
π QBrush & QBrush::operator= ( const QBrush & b ) π
Assigns b to this brush and returns a reference to this brush. so you can chain it, slay. βοΈ
π bool QBrush::operator== ( const QBrush & b ) const π
Returns TRUE if the brush is equal to b; otherwise returns FALSE.
Two brushes are equal if they have equal styles, colors and pixmaps. all three gotta match. it's giving matching outfits or nothing. π―
See also operator!=().
π QPixmap * QBrush::pixmap () const π
Returns a pointer to the custom brush pattern, or 0 if no custom brush pattern has been set. so if you get 0 back, there's no pattern, it's not being mysterious, it's just empty. π³οΈ
See also setPixmap().
Example: richtext/richtext.cpp.
π void QBrush::setColor ( const QColor & c ) π
Sets the brush color to c. new color, who dis. π
See also color() and setStyle().
Example: picture/picture.cpp.
π void QBrush::setPixmap ( const QPixmap & pixmap ) π
Sets the brush pixmap to pixmap. The style is set to CustomPattern. yep, it auto-switches the style for you, no extra step. πͺ
The current brush color will only have an effect for monochrome pixmaps, i.e. for QPixmap::depth() == 1. same deal as before β only 1-bit monochrome actually listens to the color. π
Pixmap brushes are currently not supported when printing on X11. again, X11 printing says no. π«π¨οΈ
See also pixmap() and color().
Example: richtext/richtext.cpp.
π void QBrush::setStyle ( BrushStyle s ) π
Sets the brush style to s. pick your pattern, bestie. π¨
The brush styles are:
<center>.nf
</center>
On Windows, dense and custom patterns cannot be transparent. so like, on Windows those two are opaque, periodt. πͺ
See the Detailed Description for a picture of all the styles.
See also style().
π BrushStyle QBrush::style () const π
Returns the brush style.
See also setStyle().
π RELATED FUNCTION DOCUMENTATION π
π§ QDataStream & operator<< ( QDataStream & s, const QBrush & b ) π§
Writes the brush b to the stream s and returns a reference to the stream. brush goes in, stream comes back. βοΈ
See also Format of the QDataStream operators.
π§ QDataStream & operator>> ( QDataStream & s, QBrush & b ) π§
Reads the brush b from the stream s and returns a reference to the stream. brush comes out, stream comes back. π
See also Format of the QDataStream operators.
π SEE ALSO π
π COPYRIGHT π
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement. read the license file, bestie, it's right there. π
βοΈ AUTHOR βοΈ
Generated automatically from the source code. no human wrote this one, it's a robot baby. π€
π BUGS π
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you. y'all are doing amazing sweetie, keep those reports coming. π«Ά
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. so like, the HTML is the real one, this is the cute little pocket version. π
If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qbrush.3qt) and the Qt version (3.3.8). yes, both. don't make them guess. π
and that's the whole page bestie!! πβ¨ this one came from Trolltech AS, dated 2 February 2007, for Qt version 3.3.8, and it's filed under the manual page name QBrush(3qt). go fill some shapes, you're gonna eat. π
ππ¦
π¦ where this page comes from
- fedora 43: qt3-devel-docs 3.3.8b-102.fc43 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- fedora 44: qt3-devel-docs 3.3.8b-103.fc44 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms