QBrush Class ReferenceThe QBrush class defines the fill pattern of shapes drawn by a QPainter. More... #include <qbrush.h> Inherits Qt. Public Members
Related Functions
Detailed DescriptionThe 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.
See also QPainter, QPainter::setBrush(), QPainter::setBrushOrigin(), Graphics Classes, Image Processing Classes, and Implicitly and Explicitly Shared Classes. Member Function Documentation
Constructs a default black brush with the style NoBrush (will
not fill shapes).
|
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.
See also style().
Returns the brush style.
See also setStyle().
Writes the brush b to the stream s and returns a reference to the stream.
See also Format of the QDataStream operators.
Reads the brush b from the stream s and returns a reference to the stream.
See also Format of the QDataStream operators.
This file is part of the Qt toolkit. Copyright © 1995-2003 Trolltech. All Rights Reserved.
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 3.2 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com