Eneboo - Documentación para desarrolladores
Clases | Métodos públicos | Amigas | Funciones relacionadas
Referencia de la Clase QBrush

The QBrush class defines the fill pattern of shapes drawn by a QPainter. Más...

#include <qbrush.h>

Diagrama de herencias de QBrush
Qt Qt

Lista de todos los miembros.

Clases

struct  QBrushData

Métodos públicos

 QBrush ()
 QBrush (BrushStyle)
 QBrush (const QColor &, BrushStyle=SolidPattern)
 QBrush (const QColor &, const QPixmap &)
 QBrush (const QBrush &)
 ~QBrush ()
QBrushoperator= (const QBrush &)
BrushStyle style () const
void setStyle (BrushStyle)
const QColorcolor () const
void setColor (const QColor &)
QPixmappixmap () const
void setPixmap (const QPixmap &)
bool operator== (const QBrush &p) const
bool operator!= (const QBrush &b) const
 QBrush ()
 QBrush (BrushStyle)
 QBrush (const QColor &, BrushStyle=SolidPattern)
 QBrush (const QColor &, const QPixmap &)
 QBrush (const QBrush &)
 ~QBrush ()
QBrushoperator= (const QBrush &)
BrushStyle style () const
void setStyle (BrushStyle)
const QColorcolor () const
void setColor (const QColor &)
QPixmappixmap () const
void setPixmap (const QPixmap &)
bool operator== (const QBrush &p) const
bool operator!= (const QBrush &b) const

Amigas

class QPainter

Funciones relacionadas

(Observar que estas no son funciones miembro.)

QDataStreamoperator<< (QDataStream &s, const QBrush &b)
QDataStreamoperator>> (QDataStream &s, QBrush &b)

Descripción detallada

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 (depending on how you construct a brush). This style tells the painter to not fill shapes. The standard style for filling is 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.

brush-styles.png Brush Styles

Ver también:
QPainter, QPainter::setBrush(), QPainter::setBrushOrigin()

Documentación del constructor y destructor

QBrush::QBrush ( )

Constructs a default black brush with the style NoBrush (will not fill shapes).

QBrush::QBrush ( BrushStyle  style)

Constructs a black brush with the style style.

Ver también:
setStyle()
QBrush::QBrush ( const QColor color,
BrushStyle  style = SolidPattern 
)

Constructs a brush with the color color and the style style.

Ver también:
setColor(), 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.

Pixmap brushes are currently not supported when printing on X11.

Ver también:
setColor(), setPixmap()
QBrush::QBrush ( const QBrush b)

Constructs a brush that is a shallow copy of b.

QBrush::~QBrush ( )

Destroys the brush.

QBrush::QBrush ( )
QBrush::QBrush ( BrushStyle  )
QBrush::QBrush ( const QColor ,
BrushStyle  = SolidPattern 
)
QBrush::QBrush ( const QColor ,
const QPixmap  
)
QBrush::QBrush ( const QBrush )
QBrush::~QBrush ( )

Documentación de las funciones miembro

const QColor & QBrush::color ( ) const [inline]

Returns the brush color.

Ver también:
setColor()
const QColor& QBrush::color ( ) const [inline]
bool QBrush::operator!= ( const QBrush b) const [inline]

Returns TRUE if the brush is different from b; otherwise returns FALSE.

Two brushes are different if they have different styles, colors or pixmaps.

Ver también:
operator==()
bool QBrush::operator!= ( const QBrush b) const [inline]
QBrush & QBrush::operator= ( const QBrush b)

Assigns b to this brush and returns a reference to this brush.

QBrush& QBrush::operator= ( const QBrush )
bool QBrush::operator== ( const QBrush p) const
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.

Ver también:
operator!=()
QPixmap * QBrush::pixmap ( ) const [inline]

Returns a pointer to the custom brush pattern, or 0 if no custom brush pattern has been set.

Ver también:
setPixmap()
QPixmap* QBrush::pixmap ( ) const [inline]
void QBrush::setColor ( const QColor )
void QBrush::setColor ( const QColor c)

Sets the brush color to c.

Ver también:
color(), setStyle()
void QBrush::setPixmap ( const QPixmap pixmap)

Sets the brush pixmap to pixmap. The style is set to CustomPattern.

The current brush color will only have an effect for monochrome pixmaps, i.e. for QPixmap::depth() == 1.

Pixmap brushes are currently not supported when printing on X11.

Ver también:
pixmap(), color()
void QBrush::setPixmap ( const QPixmap )
void QBrush::setStyle ( BrushStyle  )
void QBrush::setStyle ( BrushStyle  s)

Sets the brush style to s.

The brush styles are: 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 \) pattern. DiagCrossPattern diagonal crossing lines pattern. CustomPattern set when a pixmap pattern is being used.

On Windows, dense and custom patterns cannot be transparent.

See the Detailed Description for a picture of all the styles.

Ver también:
style()
BrushStyle QBrush::style ( ) const [inline]

Returns the brush style.

Ver también:
setStyle()
BrushStyle QBrush::style ( ) const [inline]

Documentación de las funciones relacionadas y clases amigas

QDataStream & operator<< ( QDataStream s,
const QBrush b 
) [related]

Writes the brush b to the stream s and returns a reference to the stream.

Ver también:
Format of the QDataStream operators
QDataStream & operator>> ( QDataStream s,
QBrush b 
) [related]

Reads the brush b from the stream s and returns a reference to the stream.

Ver también:
Format of the QDataStream operators
QPainter [friend]

La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'