QBrush Class Reference
|
To specify the style and color of lines and outlines, use the QPainter's pen combined with Qt::PenStyle and Qt::GlobalColor:QPainter painter(this); painter.setBrush(Qt::cyan); painter.setPen(Qt::darkCyan); painter.drawRect(0, 0, 100,100); painter.setBrush(Qt::NoBrush); painter.setPen(Qt::darkGreen); painter.drawRect(40, 40, 100, 100); Note that, by default, QPainter renders the outline (using the currently set pen) when drawing shapes. Use painter.setPen(Qt::NoPen) to disable this behavior. |
For more information about painting in general, see The Paint System documentation.
See also Qt::BrushStyle, QPainter, and QColor.
Constructs a default black brush with the style Qt::NoBrush (i.e. this brush will not fill shapes).
Constructs a black brush with the given style.
See also setStyle().
Constructs a brush with the given color and style.
See also setColor() and setStyle().
Constructs a brush with the given color and style.
See also setColor() and setStyle().
Constructs a brush with the given color and the custom pattern stored in pixmap.
The style is set to Qt::TexturePattern. The color will only have an effect for QBitmaps.
See also setColor() and setPixmap().
Constructs a brush with the given color and the custom pattern stored in pixmap.
The style is set to Qt::TexturePattern. The color will only have an effect for QBitmaps.
See also setColor() and setPixmap().
Constructs a brush with a black color and a texture set to the given pixmap. The style is set to Qt::TexturePattern.
See also setTexture().
Constructs a brush with a black color and a texture set to the given image. The style is set to Qt::TexturePattern.
See also setTextureImage().
Constructs a copy of other.
Constructs a brush based on the given gradient.
The brush style is set to the corresponding gradient style (either Qt::LinearGradientPattern, Qt::RadialGradientPattern or Qt::ConicalGradientPattern).
Destroys the brush.
Returns the brush color.
See also setColor().
Returns the gradient describing this brush.
Returns true if the brush is fully opaque otherwise false. A brush is considered opaque if:
Returns the current transformation matrix for the brush.
This function was introduced in Qt 4.2.
See also setMatrix().
Sets the brush color to the given color.
Note that calling setColor() will not make a difference if the style is a gradient. The same is the case if the style is Qt::TexturePattern style unless the current texture is a QBitmap.
See also color().
This is an overloaded member function, provided for convenience.
Sets the brush color to the given color.
Sets matrix as an explicit transformation matrix on the current brush. The brush transformation matrix is merged with QPainter transformation matrix to produce the final result.
This function was introduced in Qt 4.2.
See also matrix().
Sets the brush style to style.
See also style().
Sets the brush pixmap to pixmap. The style is set to Qt::TexturePattern.
The current brush color will only have an effect for monochrome pixmaps, i.e. for QPixmap::depth() == 1 (QBitmaps).
See also texture().
Sets the brush image to image. The style is set to Qt::TexturePattern.
Note the current brush color will not have any affect on monochrome images, as opposed to calling setTexture() with a QBitmap. If you want to change the color of monochrome image brushes, either convert the image to QBitmap with QBitmap::fromImage() and set the resulting QBitmap as a texture, or change the entries in the color table for the image.
This function was introduced in Qt 4.2.
See also textureImage() and setTexture().
Sets matrix as an explicit transformation matrix on the current brush. The brush transformation matrix is merged with QPainter transformation matrix to produce the final result.
This function was introduced in Qt 4.3.
See also transform().
Returns the brush style.
See also setStyle().
Returns the custom brush pattern, or a null pixmap if no custom brush pattern has been set.
See also setTexture().
Returns the custom brush pattern, or a null image if no custom brush pattern has been set.
If the texture was set as a QPixmap it will be converted to a QImage.
This function was introduced in Qt 4.2.
See also setTextureImage().
Returns the current transformation matrix for the brush.
This function was introduced in Qt 4.3.
See also setTransform().
Returns the brush as a QVariant
Returns true if the brush is different from the given brush; otherwise returns false.
Two brushes are different if they have different styles, colors or pixmaps.
See also operator==().
Assigns the given brush to this brush and returns a reference to this brush.
Returns true if the brush is equal to the given brush; otherwise returns false.
Two brushes are equal if they have equal styles, colors and pixmaps.
See also operator!=().
This is an overloaded member function, provided for convenience.
Writes the given brush to the given stream and returns a reference to the stream.
See also Format of the QDataStream Operators.
This is an overloaded member function, provided for convenience.
Reads the given brush from the given stream and returns a reference to the stream.
See also Format of the QDataStream Operators.
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 qtextended4.4 | |
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