QBrush(3qt)

πŸ“¦ version 3.3.8b, in fedora 43, fedora 44

🌸 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

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().


🧚 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 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