The QPainter class paints on paint devices. (details) (complete member list)
#include <qpainter.h>
The painter provides graphics rendering on any QPaintDevice object.
Graphics can be transformed using view transformation, world transformation or a combination of these two. View transformation is a window/viewport transformation with translation and scaling. World transformation is a full 2D transformation including rotation and shearing.
The typical use of a painter is:
Example of use:
QWidget widget;
QPainter paint;
paint.begin( &widget );
paint.setPen( blue );
paint.drawText( 20, 20, 100, 100, AlignCenter, "The Text" );
paint.end();
Constructs a painter.
Destroys the painter.
Returns the bounding rectangle of the aligned text that would be printed with the corresponding drawText() function.
The tf text formatting is the bitwise OR of the following flags:
AlignLeft
aligns to the left border.
AlignRight
aligns to the right border.
AlignHCenter
aligns horizontally centered.
AlignTop
aligns to the top border.
AlignBottom
aligns to the bottom border.
AlignVCenter
aligns vertically centered
AlignCenter
(= AlignHCenter
| AlignVCenter)
SingleLine
ignores newline characters in the text.
DontClip
never clips the text to the rectangle.
ExpandTabs
expands tabulators.
ShowPrefix
displays "&x" as "x" underlined.
WordBreak
breaks the text to fit the rectangle.
GrayText
grays out the text.
Synonymous to boundingRect(x,y,w,h,...).
Draws an arc defined by the rectangle (x,y,w,h) and the start angle a1 and the end angle a2.
Synonymous to drawArc(x,y,w,h,a1,a2).
Draws a Bezier curve defined by the npoints control points in a, starting at a[index].
Draws a chord defined by the rectangle (x,y,w,h) and the start angle a1 and the end angle a2.
Synonymous to drawChord(x,y,w,h,a1,a2).
Draws an ellipse with center at (x+w/2,y+h/2) and size (w,h).
Synonymous to drawEllipse(x,y,w,h).
Draws a line from (x1,y2) to (x2,y2).
Synonymous to drawLine(x1,y1,x2,y2).
Draws nlines separate lines from points defined in a, starting at a[index].
Draws the 1st line from a[index] to a[index+1]. Draws the 2nd line from a[index+2] to a[index+3] etc.
Replays the picture pic.
This function does exactly the same as QPicture::play().
Draws a pie defined by the rectangle (x,y,w,h) and the start angle a1 and the end angle a2.
Synonymous to drawPie(x,y,w,h,a1,a2).
Draws a pixmap at (x,y).
Synonymous to drawPixmap(x,y,pm).
Synonymous to drawPoint(x,y).
Draws the polygon defined by the npoints points in a starting at a[index].
The first point is connected to the last point.
Draws the polyline defined by the npoints points in a starting at a[index].
Draws a rectangle with upper left corner at (x,y) and with width w and height h.
The width and height include both lines.
Synonymous to drawRect(x,y,w,h).
Draws a rectangle with round corners at (x,y), with width w and height h.
The xRnd and yRnd arguments indicate how rounded the corners should be. 0 is angled corners, 99 is maximum roundedness.
The width and height include both lines.
Synonymous to drawRoundRect(x,y,w,h,xRnd,yRnd).
Draw a horizontal (y1 == y2) or vertical (x1 == x2) shaded line.
The tColor argument specifies the top (or left) color and bColor specifies the bottom (or right) color.
The lw argument specifies the line width for each of the lines. It is not the total line width.
The mw argument specifies the width of a middle line drawn in mColor.
If tColor is brighter that bColor, the line appears to be raised from the surface. If tColor is darker that bColor, the line appears to be sunken into the surface.
See also: drawShadeRect() and drawShadePanel().
Synonymous to drawShadeLine(x1,y1,x2,y2,...).
Draw a shaded panel given by (x,y,w,h).
Synonymous to drawShadePanel(x1,y1,x2,y2,...).
Draw a shaded rectangle given by (x,y,w,h).
The arguments have the same meaning as for drawShadeLine().
See also: drawShadeLine(), drawShadePanel()
Synonymous to drawShadeRect(x1,y1,x2,y2,...).
Draws at most len characters from str at position (x,y).
(x,y) is the base line position.
Draws at most len characters from str in the rectangle (x,y,w,h).
This function draws formatted text.
The tf text formatting is the bitwise OR of the following flags:
AlignLeft
aligns to the left border.
AlignRight
aligns to the right border.
AlignHCenter
aligns horizontally centered.
AlignTop
aligns to the top border.
AlignBottom
aligns to the bottom border.
AlignVCenter
aligns vertically centered
AlignCenter
(= AlignHCenter
| AlignVCenter)
SingleLine
ignores newline characters in the text.
DontClip
never clips the text to the rectangle.
ExpandTabs
expands tabulators.
ShowPrefix
displays "&x" as "x" underlined.
WordBreak
breaks the text to fit the rectangle.
GrayText
grays out the text.
Synonymous to drawText(x,y,...).
Synonymous to drawText(x,y,w,h,...).
Calls fillRect( x, y, w, h, backgroundColor() )
.
Synonymous to eraseRect(x,y,w,h).
Fills the rectangle (x,y,w,h) with a color.
Synonymous to fillRect(x,y,w,h,c).
Returns the current painter font.
Synonymous to lineTo(x,y).
Synonymous to moveTo(x,y).
Redirects all paint command to a a paint device pd. Careful here!
Sets the background color of the painter to c.
See also: backgroundColor().
Synonymous to setBrushOrigin(x,y).
Synonymous to setViewport(QRect).
Sets the viewport rectangle view transformation for the painter and enables view transformation.
The viewport rectangle is part of the view transformation. View transformations can be combined with world transformations.
See also: viewport(), setViewport() and setWorldMatrix().
Synonymous to setViewport(x,y,w,h).
Sets the window rectangle view transformation for the painter and enables view transformation.
The window rectangle is part of the view transformation. View transformations can be combined with world transformations.
See also: window(), setViewport() and setWorldMatrix().
Synonymous to setWindow(x,y,w,h).
Sets the world transformation matrix to m.
If combine is TRUE, then m is combined with the current transformation matrix.
See also: worldMatrix(), setWindow() and setViewport().
Returns the point pv transformed from user coordinates to device coordinates.
Returns the rectangle rv transformed from user coordinates to device coordinates.
If world transformation is enabled and rotation or shearing is used, then the bounding rectangle will be returned.
Returns the point array av transformed from user coordinates to device coordinates.
Returns the point pv transformed from device coordinates to user coordinates.
Returns the rectangle rv transformed from device coordinates to user coordinates.
If world transformation is enabled and rotation or shearing is used, then the bounding rectangle will be returned.
Returns the point array av transformed from device coordinates to user coordinates.
This file is part of the Qt toolkit, copyright 1995 Troll Tech, all rights reserved.
It was generated from the following files: