Eneboo - Documentación para desarrolladores
|
The QPainter class does low-level painting e.g. on widgets. Más...
#include <qpainter.h>
Tipos públicos | |
enum | CoordinateMode { CoordDevice, CoordPainter, CoordDevice, CoordPainter } |
enum | TextDirection { Auto, RTL, LTR, Auto, RTL, LTR } |
enum | CoordinateMode { CoordDevice, CoordPainter, CoordDevice, CoordPainter } |
enum | TextDirection { Auto, RTL, LTR, Auto, RTL, LTR } |
Métodos públicos | |
QPainter () | |
QPainter (const QPaintDevice *, bool unclipped=FALSE) | |
QPainter (const QPaintDevice *, const QWidget *, bool unclipped=FALSE) | |
~QPainter () | |
bool | begin (const QPaintDevice *, bool unclipped=FALSE) |
bool | begin (const QPaintDevice *, const QWidget *, bool unclipped=FALSE) |
bool | end () |
QPaintDevice * | device () const |
bool | isActive () const |
void | flush (const QRegion ®ion, CoordinateMode cm=CoordDevice) |
void | flush () |
void | save (const QString &id=QString::null) |
void | restore () |
QFontMetrics | fontMetrics () const |
QFontInfo | fontInfo () const |
const QFont & | font () const |
void | setFont (const QFont &) |
const QPen & | pen () const |
void | setPen (const QPen &) |
void | setPen (PenStyle) |
void | setPen (const QColor &) |
const QBrush & | brush () const |
void | setBrush (const QBrush &) |
void | setBrush (BrushStyle) |
void | setBrush (const QColor &) |
QPoint | pos () const |
const QColor & | backgroundColor () const |
void | setBackgroundColor (const QColor &) |
BGMode | backgroundMode () const |
void | setBackgroundMode (BGMode) |
RasterOp | rasterOp () const |
void | setRasterOp (RasterOp) |
const QPoint & | brushOrigin () const |
void | setBrushOrigin (int x, int y) |
void | setBrushOrigin (const QPoint &) |
bool | hasViewXForm () const |
bool | hasWorldXForm () const |
void | setViewXForm (bool) |
QRect | window () const |
void | setWindow (const QRect &) |
void | setWindow (int x, int y, int w, int h) |
QRect | viewport () const |
void | setViewport (const QRect &) |
void | setViewport (int x, int y, int w, int h) |
void | setWorldXForm (bool) |
const QWMatrix & | worldMatrix () const |
void | setWorldMatrix (const QWMatrix &, bool combine=FALSE) |
void | saveWorldMatrix () |
void | restoreWorldMatrix () |
void | scale (double sx, double sy) |
void | shear (double sh, double sv) |
void | rotate (double a) |
void | translate (double dx, double dy) |
void | resetXForm () |
double | translationX () const |
double | translationY () const |
QPoint | xForm (const QPoint &) const |
QRect | xForm (const QRect &) const |
QPointArray | xForm (const QPointArray &) const |
QPointArray | xForm (const QPointArray &, int index, int npoints) const |
QPoint | xFormDev (const QPoint &) const |
QRect | xFormDev (const QRect &) const |
QPointArray | xFormDev (const QPointArray &) const |
QPointArray | xFormDev (const QPointArray &, int index, int npoints) const |
void | setClipping (bool) |
bool | hasClipping () const |
QRegion | clipRegion (CoordinateMode=CoordDevice) const |
void | setClipRect (const QRect &, CoordinateMode=CoordDevice) |
void | setClipRect (int x, int y, int w, int h, CoordinateMode=CoordDevice) |
void | setClipRegion (const QRegion &, CoordinateMode=CoordDevice) |
void | drawPoint (int x, int y) |
void | drawPoint (const QPoint &) |
void | drawPoints (const QPointArray &a, int index=0, int npoints=-1) |
void | moveTo (int x, int y) |
void | moveTo (const QPoint &) |
void | lineTo (int x, int y) |
void | lineTo (const QPoint &) |
void | drawLine (int x1, int y1, int x2, int y2) |
void | drawLine (const QPoint &, const QPoint &) |
void | drawRect (int x, int y, int w, int h) |
void | drawRect (const QRect &) |
void | drawWinFocusRect (int x, int y, int w, int h) |
void | drawWinFocusRect (int x, int y, int w, int h, const QColor &bgColor) |
void | drawWinFocusRect (const QRect &) |
void | drawWinFocusRect (const QRect &, const QColor &bgColor) |
void | drawRoundRect (int x, int y, int w, int h, int=25, int=25) |
void | drawRoundRect (const QRect &, int=25, int=25) |
void | drawEllipse (int x, int y, int w, int h) |
void | drawEllipse (const QRect &) |
void | drawArc (int x, int y, int w, int h, int a, int alen) |
void | drawArc (const QRect &, int a, int alen) |
void | drawPie (int x, int y, int w, int h, int a, int alen) |
void | drawPie (const QRect &, int a, int alen) |
void | drawChord (int x, int y, int w, int h, int a, int alen) |
void | drawChord (const QRect &, int a, int alen) |
void | drawLineSegments (const QPointArray &, int index=0, int nlines=-1) |
void | drawPolyline (const QPointArray &, int index=0, int npoints=-1) |
void | drawPolygon (const QPointArray &, bool winding=FALSE, int index=0, int npoints=-1) |
void | drawConvexPolygon (const QPointArray &, int index=0, int npoints=-1) |
void | drawCubicBezier (const QPointArray &, int index=0) |
void | drawPixmap (int x, int y, const QPixmap &, int sx=0, int sy=0, int sw=-1, int sh=-1) |
void | drawPixmap (const QPoint &, const QPixmap &, const QRect &sr) |
void | drawPixmap (const QPoint &, const QPixmap &) |
void | drawPixmap (const QRect &, const QPixmap &) |
void | drawImage (int x, int y, const QImage &, int sx=0, int sy=0, int sw=-1, int sh=-1, int conversionFlags=0) |
void | drawImage (const QPoint &, const QImage &, const QRect &sr, int conversionFlags=0) |
void | drawImage (const QPoint &, const QImage &, int conversion_flags=0) |
void | drawImage (const QRect &, const QImage &) |
void | drawTiledPixmap (int x, int y, int w, int h, const QPixmap &, int sx=0, int sy=0) |
void | drawTiledPixmap (const QRect &, const QPixmap &, const QPoint &) |
void | drawTiledPixmap (const QRect &, const QPixmap &) |
void | drawPicture (const QPicture &) |
void | drawPicture (int x, int y, const QPicture &) |
void | drawPicture (const QPoint &, const QPicture &) |
void | fillRect (int x, int y, int w, int h, const QBrush &) |
void | fillRect (const QRect &, const QBrush &) |
void | eraseRect (int x, int y, int w, int h) |
void | eraseRect (const QRect &) |
void | drawText (int x, int y, const QString &, int len=-1, TextDirection dir=Auto) |
void | drawText (const QPoint &, const QString &, int len=-1, TextDirection dir=Auto) |
void | drawText (int x, int y, const QString &, int pos, int len, TextDirection dir=Auto) |
void | drawText (const QPoint &p, const QString &, int pos, int len, TextDirection dir=Auto) |
void | drawText (int x, int y, int w, int h, int flags, const QString &, int len=-1, QRect *br=0, QTextParag **intern=0) |
void | drawText (const QRect &, int flags, const QString &, int len=-1, QRect *br=0, QTextParag **intern=0) |
void | drawTextItem (int x, int y, const QTextItem &ti, int textflags=0) |
void | drawTextItem (const QPoint &p, const QTextItem &ti, int textflags=0) |
QRect | boundingRect (int x, int y, int w, int h, int flags, const QString &, int len=-1, QTextParag **intern=0) |
QRect | boundingRect (const QRect &, int flags, const QString &, int len=-1, QTextParag **intern=0) |
int | tabStops () const |
void | setTabStops (int) |
int * | tabArray () const |
void | setTabArray (int *) |
QPainter () | |
QPainter (const QPaintDevice *, bool unclipped=FALSE) | |
QPainter (const QPaintDevice *, const QWidget *, bool unclipped=FALSE) | |
~QPainter () | |
bool | begin (const QPaintDevice *, bool unclipped=FALSE) |
bool | begin (const QPaintDevice *, const QWidget *, bool unclipped=FALSE) |
bool | end () |
QPaintDevice * | device () const |
bool | isActive () const |
void | flush (const QRegion ®ion, CoordinateMode cm=CoordDevice) |
void | flush () |
void | save (const QString &id=QString::null) |
void | restore () |
QFontMetrics | fontMetrics () const |
QFontInfo | fontInfo () const |
const QFont & | font () const |
void | setFont (const QFont &) |
const QPen & | pen () const |
void | setPen (const QPen &) |
void | setPen (PenStyle) |
void | setPen (const QColor &) |
const QBrush & | brush () const |
void | setBrush (const QBrush &) |
void | setBrush (BrushStyle) |
void | setBrush (const QColor &) |
QPoint | pos () const |
const QColor & | backgroundColor () const |
void | setBackgroundColor (const QColor &) |
BGMode | backgroundMode () const |
void | setBackgroundMode (BGMode) |
RasterOp | rasterOp () const |
void | setRasterOp (RasterOp) |
const QPoint & | brushOrigin () const |
void | setBrushOrigin (int x, int y) |
void | setBrushOrigin (const QPoint &) |
bool | hasViewXForm () const |
bool | hasWorldXForm () const |
void | setViewXForm (bool) |
QRect | window () const |
void | setWindow (const QRect &) |
void | setWindow (int x, int y, int w, int h) |
QRect | viewport () const |
void | setViewport (const QRect &) |
void | setViewport (int x, int y, int w, int h) |
void | setWorldXForm (bool) |
const QWMatrix & | worldMatrix () const |
void | setWorldMatrix (const QWMatrix &, bool combine=FALSE) |
void | saveWorldMatrix () |
void | restoreWorldMatrix () |
void | scale (double sx, double sy) |
void | shear (double sh, double sv) |
void | rotate (double a) |
void | translate (double dx, double dy) |
void | resetXForm () |
double | translationX () const |
double | translationY () const |
QPoint | xForm (const QPoint &) const |
QRect | xForm (const QRect &) const |
QPointArray | xForm (const QPointArray &) const |
QPointArray | xForm (const QPointArray &, int index, int npoints) const |
QPoint | xFormDev (const QPoint &) const |
QRect | xFormDev (const QRect &) const |
QPointArray | xFormDev (const QPointArray &) const |
QPointArray | xFormDev (const QPointArray &, int index, int npoints) const |
void | setClipping (bool) |
bool | hasClipping () const |
QRegion | clipRegion (CoordinateMode=CoordDevice) const |
void | setClipRect (const QRect &, CoordinateMode=CoordDevice) |
void | setClipRect (int x, int y, int w, int h, CoordinateMode=CoordDevice) |
void | setClipRegion (const QRegion &, CoordinateMode=CoordDevice) |
void | drawPoint (int x, int y) |
void | drawPoint (const QPoint &) |
void | drawPoints (const QPointArray &a, int index=0, int npoints=-1) |
void | moveTo (int x, int y) |
void | moveTo (const QPoint &) |
void | lineTo (int x, int y) |
void | lineTo (const QPoint &) |
void | drawLine (int x1, int y1, int x2, int y2) |
void | drawLine (const QPoint &, const QPoint &) |
void | drawRect (int x, int y, int w, int h) |
void | drawRect (const QRect &) |
void | drawWinFocusRect (int x, int y, int w, int h) |
void | drawWinFocusRect (int x, int y, int w, int h, const QColor &bgColor) |
void | drawWinFocusRect (const QRect &) |
void | drawWinFocusRect (const QRect &, const QColor &bgColor) |
void | drawRoundRect (int x, int y, int w, int h, int=25, int=25) |
void | drawRoundRect (const QRect &, int=25, int=25) |
void | drawEllipse (int x, int y, int w, int h) |
void | drawEllipse (const QRect &) |
void | drawArc (int x, int y, int w, int h, int a, int alen) |
void | drawArc (const QRect &, int a, int alen) |
void | drawPie (int x, int y, int w, int h, int a, int alen) |
void | drawPie (const QRect &, int a, int alen) |
void | drawChord (int x, int y, int w, int h, int a, int alen) |
void | drawChord (const QRect &, int a, int alen) |
void | drawLineSegments (const QPointArray &, int index=0, int nlines=-1) |
void | drawPolyline (const QPointArray &, int index=0, int npoints=-1) |
void | drawPolygon (const QPointArray &, bool winding=FALSE, int index=0, int npoints=-1) |
void | drawConvexPolygon (const QPointArray &, int index=0, int npoints=-1) |
void | drawCubicBezier (const QPointArray &, int index=0) |
void | drawPixmap (int x, int y, const QPixmap &, int sx=0, int sy=0, int sw=-1, int sh=-1) |
void | drawPixmap (const QPoint &, const QPixmap &, const QRect &sr) |
void | drawPixmap (const QPoint &, const QPixmap &) |
void | drawPixmap (const QRect &, const QPixmap &) |
void | drawImage (int x, int y, const QImage &, int sx=0, int sy=0, int sw=-1, int sh=-1, int conversionFlags=0) |
void | drawImage (const QPoint &, const QImage &, const QRect &sr, int conversionFlags=0) |
void | drawImage (const QPoint &, const QImage &, int conversion_flags=0) |
void | drawImage (const QRect &, const QImage &) |
void | drawTiledPixmap (int x, int y, int w, int h, const QPixmap &, int sx=0, int sy=0) |
void | drawTiledPixmap (const QRect &, const QPixmap &, const QPoint &) |
void | drawTiledPixmap (const QRect &, const QPixmap &) |
void | drawPicture (const QPicture &) |
void | drawPicture (int x, int y, const QPicture &) |
void | drawPicture (const QPoint &, const QPicture &) |
void | fillRect (int x, int y, int w, int h, const QBrush &) |
void | fillRect (const QRect &, const QBrush &) |
void | eraseRect (int x, int y, int w, int h) |
void | eraseRect (const QRect &) |
void | drawText (int x, int y, const QString &, int len=-1, TextDirection dir=Auto) |
void | drawText (const QPoint &, const QString &, int len=-1, TextDirection dir=Auto) |
void | drawText (int x, int y, const QString &, int pos, int len, TextDirection dir=Auto) |
void | drawText (const QPoint &p, const QString &, int pos, int len, TextDirection dir=Auto) |
void | drawText (int x, int y, int w, int h, int flags, const QString &, int len=-1, QRect *br=0, QTextParag **intern=0) |
void | drawText (const QRect &, int flags, const QString &, int len=-1, QRect *br=0, QTextParag **intern=0) |
void | drawTextItem (int x, int y, const QTextItem &ti, int textflags=0) |
void | drawTextItem (const QPoint &p, const QTextItem &ti, int textflags=0) |
QRect | boundingRect (int x, int y, int w, int h, int flags, const QString &, int len=-1, QTextParag **intern=0) |
QRect | boundingRect (const QRect &, int flags, const QString &, int len=-1, QTextParag **intern=0) |
int | tabStops () const |
void | setTabStops (int) |
int * | tabArray () const |
void | setTabArray (int *) |
Métodos públicos estáticos | |
static void | redirect (QPaintDevice *pdev, QPaintDevice *replacement) |
static QPaintDevice * | redirect (QPaintDevice *pdev) |
static void | initialize () |
static void | cleanup () |
static void | redirect (QPaintDevice *pdev, QPaintDevice *replacement) |
static QPaintDevice * | redirect (QPaintDevice *pdev) |
static void | initialize () |
static void | cleanup () |
Amigas | |
class | QFontMetrics |
class | QFontInfo |
class | QTextLayout |
class | QPrinter |
void | qt_format_text (const QFont &, const QRect &r, int tf, const QString &str, int len, QRect *brect, int tabstops, int *tabarray, int tabarraylen, QTextParag **internal, QPainter *painter) |
void | qt_draw_background (QPainter *p, int x, int y, int w, int h) |
void | qt_draw_transformed_rect (QPainter *p, int x, int y, int w, int h, bool fill) |
void | qt_format_text (const QFont &, const QRect &r, int tf, const QString &str, int len, QRect *brect, int tabstops, int *tabarray, int tabarraylen, QTextParag **internal, QPainter *painter) |
void | qt_draw_background (QPainter *p, int x, int y, int w, int h) |
void | qt_draw_transformed_rect (QPainter *p, int x, int y, int w, int h, bool fill) |
Funciones relacionadas | |
(Observar que estas no son funciones miembro.) | |
void | qDrawShadeLine (QPainter *p, int x1, int y1, int x2, int y2, const QColorGroup &g, bool sunken, int lineWidth, int midLineWidth) |
void | qDrawShadeRect (QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken, int lineWidth, int midLineWidth, const QBrush *fill) |
void | qDrawShadePanel (QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken, int lineWidth, const QBrush *fill) |
void | qDrawWinButton (QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken, const QBrush *fill) |
void | qDrawWinPanel (QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken, const QBrush *fill) |
void | qDrawPlainRect (QPainter *p, int x, int y, int w, int h, const QColor &c, int lineWidth, const QBrush *fill) |
void | qDrawShadeLine |
void | qDrawShadeRect |
void | qDrawShadePanel |
void | qDrawWinButton |
void | qDrawWinPanel |
void | qDrawPlainRect |
The QPainter class does low-level painting e.g. on widgets.
The painter provides highly optimized functions to do most of the drawing GUI programs require. QPainter can draw everything from simple lines to complex shapes like pies and chords. It can also draw aligned text and pixmaps. Normally, it draws in a "natural" coordinate system, but it can also do view and world transformation.
The typical use of a painter is:
Construct a painter. Set a pen, a brush etc. Draw. Destroy the painter.
Mostly, all this is done inside a paint event. (In fact, 99% of all QPainter use is in a reimplementation of QWidget::paintEvent(), and the painter is heavily optimized for such use.) Here's one very simple example:
void SimpleExampleWidget::paintEvent() { QPainter paint( this ); paint.setPen( Qt::blue ); paint.drawText( rect(), AlignCenter, "The Text" ); }
Usage is simple, and there are many settings you can use:
font() is the currently set font. If you set a font that isn't available, Qt finds a close match. In fact font() returns what you set using setFont() and fontInfo() returns the font actually being used (which may be the same).
brush() is the currently set brush; the color or pattern that's used for filling e.g. circles.
pen() is the currently set pen; the color or stipple that's used for drawing lines or boundaries.
backgroundMode() is Opaque
or Transparent
, i.e. whether backgroundColor() is used or not.
backgroundColor() only applies when backgroundMode() is Opaque and pen() is a stipple. In that case, it describes the color of the background pixels in the stipple.
rasterOp() is how pixels drawn interact with the pixels already there.
brushOrigin() is the origin of the tiled brushes, normally the origin of the window.
viewport(), window(), worldMatrix() and many more make up the painter's coordinate transformation system. See The Coordinate System for an explanation of this, or see below for a very brief overview of the functions.
hasClipping() is whether the painter clips at all. (The paint device clips, too.) If the painter clips, it clips to clipRegion().
pos() is the current position, set by moveTo() and used by lineTo().
Note that some of these settings mirror settings in some paint devices, e.g. QWidget::font(). QPainter::begin() (or the QPainter constructor) copies these attributes from the paint device. Calling, for example, QWidget::setFont() doesn't take effect until the next time a painter begins painting on it.
save() saves all of these settings on an internal stack, restore() pops them back.
The core functionality of QPainter is drawing, and there are functions to draw most primitives: drawPoint(), drawPoints(), drawLine(), drawRect(), drawWinFocusRect(), drawRoundRect(), drawEllipse(), drawArc(), drawPie(), drawChord(), drawLineSegments(), drawPolyline(), drawPolygon(), drawConvexPolygon() and drawCubicBezier(). All of these functions take integer coordinates; there are no floating-point versions since we want drawing to be as fast as possible.
There are functions to draw pixmaps/images, namely drawPixmap(), drawImage() and drawTiledPixmap(). drawPixmap() and drawImage() produce the same result, except that drawPixmap() is faster on-screen and drawImage() faster and sometimes better on QPrinter and QPicture.
Text drawing is done using drawText(), and when you need fine-grained positioning, boundingRect() tells you where a given drawText() command would draw.
There is a drawPicture() function that draws the contents of an entire QPicture using this painter. drawPicture() is the only function that disregards all the painter's settings: the QPicture has its own settings.
Normally, the QPainter operates on the device's own coordinate system (usually pixels), but QPainter has good support for coordinate transformation. See The Coordinate System for a more general overview and a simple example.
The most common functions used are scale(), rotate(), translate() and shear(), all of which operate on the worldMatrix(). setWorldMatrix() can replace or add to the currently set worldMatrix().
setViewport() sets the rectangle on which QPainter operates. The default is the entire device, which is usually fine, except on printers. setWindow() sets the coordinate system, that is, the rectangle that maps to viewport(). What's drawn inside the window() ends up being inside the viewport(). The window's default is the same as the viewport, and if you don't use the transformations, they are optimized away, gaining another little bit of speed.
After all the coordinate transformation is done, QPainter can clip the drawing to an arbitrary rectangle or region. hasClipping() is TRUE if QPainter clips, and clipRegion() returns the clip region. You can set it using either setClipRegion() or setClipRect(). Note that the clipping can be slow. It's all system-dependent, but as a rule of thumb, you can assume that drawing speed is inversely proportional to the number of rectangles in the clip region.
After QPainter's clipping, the paint device may also clip. For example, most widgets clip away the pixels used by child widgets, and most printers clip away an area near the edges of the paper. This additional clipping is not reflected by the return value of clipRegion() or hasClipping().
QPainter also includes some less-used functions that are very useful on those occasions when they're needed.
isActive() indicates whether the painter is active. begin() (and the most usual constructor) makes it active. end() (and the destructor) deactivates it. If the painter is active, device() returns the paint device on which the painter paints.
Sometimes it is desirable to make someone else paint on an unusual QPaintDevice. QPainter supports a static function to do this, redirect(). We recommend not using it, but for some hacks it's perfect.
setTabStops() and setTabArray() can change where the tab stops are, but these are very seldomly used.
CoordDevice CoordPainter
Auto RTL right to left LTR left to right
QPainter::QPainter | ( | ) |
QPainter::QPainter | ( | const QPaintDevice * | pd, |
bool | unclipped = FALSE |
||
) |
Constructs a painter that begins painting the paint device pd immediately. Depending on the underlying graphic system the painter will paint over children of the paintdevice if unclipped is TRUE.
This constructor is convenient for short-lived painters, e.g. in a paint event and should be used only once. The constructor calls begin() for you and the QPainter destructor automatically calls end().
Here's an example using begin() and end():
void MyWidget::paintEvent( QPaintEvent * ) { QPainter p; p.begin( this ); p.drawLine( ... ); // drawing code p.end(); }
The same example using this constructor:
void MyWidget::paintEvent( QPaintEvent * ) { QPainter p( this ); p.drawLine( ... ); // drawing code }
Since the constructor cannot provide feedback when the initialization of the painter failed you should rather use begin() and end() to paint on external devices, e.g. printers.
QPainter::QPainter | ( | const QPaintDevice * | pd, |
const QWidget * | copyAttributes, | ||
bool | unclipped = FALSE |
||
) |
Constructs a painter that begins painting the paint device pd immediately, with the default arguments taken from copyAttributes. The painter will paint over children of the paint device if unclipped is TRUE (although this is not supported on all platforms).
QPainter::~QPainter | ( | ) |
Destroys the painter.
QPainter::QPainter | ( | ) |
QPainter::QPainter | ( | const QPaintDevice * | , |
bool | unclipped = FALSE |
||
) |
QPainter::QPainter | ( | const QPaintDevice * | , |
const QWidget * | , | ||
bool | unclipped = FALSE |
||
) |
QPainter::~QPainter | ( | ) |
const QColor & QPainter::backgroundColor | ( | ) | const [inline] |
Returns the current background color.
const QColor& QPainter::backgroundColor | ( | ) | const |
BGMode QPainter::backgroundMode | ( | ) | const |
Qt::BGMode QPainter::backgroundMode | ( | ) | const [inline] |
Returns the current background mode.
bool QPainter::begin | ( | const QPaintDevice * | , |
const QWidget * | , | ||
bool | unclipped = FALSE |
||
) |
bool QPainter::begin | ( | const QPaintDevice * | pd, |
const QWidget * | copyAttributes, | ||
bool | unclipped = FALSE |
||
) |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
This version opens the painter on a paint device pd and sets the initial pen, background color and font from copyAttributes, painting over the paint device's children when unclipped is TRUE. This is equivalent to:
QPainter p; p.begin( pd ); p.setPen( copyAttributes->foregroundColor() ); p.setBackgroundColor( copyAttributes->backgroundColor() ); p.setFont( copyAttributes->font() );
This begin function is convenient for double buffering. When you draw in a pixmap instead of directly in a widget (to later bitBlt the pixmap into the widget) you will need to set the widget's font etc. This function does exactly that.
Example:
void MyWidget::paintEvent( QPaintEvent * ) { QPixmap pm(size()); QPainter p; p.begin(&pm, this); // ... potentially flickering paint operation ... p.end(); bitBlt(this, 0, 0, &pm); }
bool QPainter::begin | ( | const QPaintDevice * | , |
bool | unclipped = FALSE |
||
) |
bool QPainter::begin | ( | const QPaintDevice * | pd, |
bool | unclipped = FALSE |
||
) |
Begins painting the paint device pd and returns TRUE if successful, or FALSE if an error occurs.
The errors that can occur are serious problems, such as these:
p->begin( 0 ); // impossible - paint device cannot be 0 QPixmap pm( 0, 0 ); p->begin( pm ); // impossible - pm.isNull(); p->begin( myWidget ); p2->begin( myWidget ); // impossible - only one painter at a time
Note that most of the time, you can use one of the constructors instead of begin(), and that end() is automatically done at destruction.
Begins painting the paint device pd and returns TRUE if successful; otherwise returns FALSE. If unclipped is TRUE, the painting will not be clipped at the paint device's boundaries, (although this is not supported by all platforms).
The errors that can occur are serious problems, such as these:
p->begin( 0 ); // impossible - paint device cannot be 0 QPixmap pm( 0, 0 ); p->begin( pm ); // impossible - pm.isNull(); p->begin( myWidget ); p2->begin( myWidget ); // impossible - only one painter at a time
Note that most of the time, you can use one of the constructors instead of begin(), and that end() is automatically done at destruction.
QRect QPainter::boundingRect | ( | int | x, |
int | y, | ||
int | w, | ||
int | h, | ||
int | flags, | ||
const QString & | , | ||
int | len = -1 , |
||
QTextParag ** | intern = 0 |
||
) |
QRect QPainter::boundingRect | ( | const QRect & | , |
int | flags, | ||
const QString & | , | ||
int | len = -1 , |
||
QTextParag ** | intern = 0 |
||
) |
QRect QPainter::boundingRect | ( | int | x, |
int | y, | ||
int | w, | ||
int | h, | ||
int | flags, | ||
const QString & | str, | ||
int | len = -1 , |
||
QTextParag ** | intern = 0 |
||
) | [inline] |
Returns the bounding rectangle of the aligned text that would be printed with the corresponding drawText() function using the first len characters of the string if len is > -1, or the whole of the string if len is -1. The drawing, and hence the bounding rectangle, is constrained to the rectangle that begins at point (x, y) with width w and hight h, or to the rectangle required to draw the text, whichever is the larger.
The flags argument is the bitwise OR of the following flags: Flag Meaning AlignAuto
aligns according to the language, usually left. 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. ExpandTabs
expands tabs. ShowPrefix
interprets "&x" as "<u>x</u>". WordBreak
breaks the text to fit the rectangle.
Horizontal alignment defaults to AlignLeft
and vertical alignment defaults to AlignTop
.
If several of the horizontal or several of the vertical alignment flags are set, the resulting alignment is undefined.
The intern parameter should not be used.
QRect QPainter::boundingRect | ( | const QRect & | r, |
int | flags, | ||
const QString & | str, | ||
int | len = -1 , |
||
QTextParag ** | internal = 0 |
||
) |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Returns the bounding rectangle of the aligned text that would be printed with the corresponding drawText() function using the first len characters from str if len is > -1, or the whole of str if len is -1. The drawing, and hence the bounding rectangle, is constrained to the rectangle r, or to the rectangle required to draw the text, whichever is the larger.
The internal parameter should not be used.
const QBrush& QPainter::brush | ( | ) | const |
const QBrush & QPainter::brush | ( | ) | const [inline] |
Returns the painter's current brush.
const QPoint& QPainter::brushOrigin | ( | ) | const |
const QPoint & QPainter::brushOrigin | ( | ) | const [inline] |
Returns the brush origin currently set.
void QPainter::cleanup | ( | ) | [static] |
Internal function that cleans up the painter.
static void QPainter::cleanup | ( | ) | [static] |
QRegion QPainter::clipRegion | ( | CoordinateMode | m = CoordDevice | ) | const |
Returns the currently set clip region. Note that the clip region is given in physical device coordinates and not subject to any coordinate transformation if m is equal to CoordDevice
(the default). If m equals CoordPainter
the returned region is in model coordinates.
QRegion QPainter::clipRegion | ( | CoordinateMode | = CoordDevice | ) | const |
QPaintDevice * QPainter::device | ( | ) | const [inline] |
Returns the paint device on which this painter is currently painting, or 0 if the painter is not active.
QPaintDevice* QPainter::device | ( | ) | const |
Draws an arc defined by the rectangle (x,y,w,h), the start angle a and the arc length alen.
The angles a and alen are 1/16th of a degree, i.e. a full circle equals 5760 (16*360). Positive values of a and alen mean counter-clockwise while negative values mean clockwise direction. Zero degrees is at the 3'o clock position.
Example:
Draws an arc defined by the rectangle (x, y, w, h), the start angle a and the arc length alen.
The angles a and alen are 1/16th of a degree, i.e. a full circle equals 5760 (16*360). Positive values of a and alen mean counter-clockwise while negative values mean the clockwise direction. Zero degrees is at the 3 o'clock position.
Example:
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Draws the arc that fits inside the rectangle r with start angle a and arc length alen.
Draws a chord defined by the rectangle (x,y,w,h), the start angle a and the arc length alen.
The chord is filled with the current brush().
The angles a and alen are 1/16th of a degree, i.e. a full circle equals 5760 (16*360). Positive values of a and alen mean counter-clockwise while negative values mean clockwise direction. Zero degrees is at the 3'o clock position.
Draws a chord defined by the rectangle (x, y, w, h), the start angle a and the arc length alen.
The chord is filled with the current brush().
The angles a and alen are 1/16th of a degree, i.e. a full circle equals 5760 (16*360). Positive values of a and alen mean counter-clockwise while negative values mean the clockwise direction. Zero degrees is at the 3 o'clock position.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Draws a chord that fits inside the rectangle r with start angle a and arc length alen.
void QPainter::drawConvexPolygon | ( | const QPointArray & | pa, |
int | index = 0 , |
||
int | npoints = -1 |
||
) |
Draws the convex polygon defined by the npoints points in pa starting at pa[index] (index defaults to 0).
If the supplied polygon is not convex, the results are undefined.
On some platforms (e.g. X Window), this is faster than drawPolygon().
Draws the convex polygon defined by the npoints points in pa starting at pa[index] (index defaults to 0).
If the supplied polygon is not convex, the results are undefined.
On some platforms (e.g. X Window), this is faster than drawPolygon().
void QPainter::drawConvexPolygon | ( | const QPointArray & | , |
int | index = 0 , |
||
int | npoints = -1 |
||
) |
void QPainter::drawCubicBezier | ( | const QPointArray & | a, |
int | index = 0 |
||
) |
Draws a cubic Bezier curve defined by the control points in a, starting at a[index] (index defaults to 0).
Control points after a[index + 3] are ignored. Nothing happens if there aren't enough control points.
Draws a cubic Bezier curve defined by the control points in a, starting at a[index] (index defaults to 0).
Control points after a[index + 3] are ignored. Nothing happens if there aren't enough control points.
void QPainter::drawCubicBezier | ( | const QPointArray & | , |
int | index = 0 |
||
) |
Draws an ellipse with center at (x+w/2,y+h/2) and size (w,h).
Draws an ellipse with center at (x + w/2, y + h/2) and size (w, h).
void QPainter::drawEllipse | ( | const QRect & | r | ) | [inline] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Draws the ellipse that fits inside rectangle r.
void QPainter::drawEllipse | ( | const QRect & | ) |
void QPainter::drawImage | ( | int | x, |
int | y, | ||
const QImage & | image, | ||
int | sx = 0 , |
||
int | sy = 0 , |
||
int | sw = -1 , |
||
int | sh = -1 , |
||
int | conversionFlags = 0 |
||
) |
Draws at (x, y) the sw by sh area of pixels from (sx, sy) in image, using conversionFlags if the image needs to be converted to a pixmap. The default value for conversionFlags is 0; see convertFromImage() for information about what other values do.
This function may convert image to a pixmap and then draw it, if device() is a QPixmap or a QWidget, or else draw it directly, if device() is a QPrinter or QPicture.
Currently alpha masks of the image are ignored when painting on a QPrinter.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Draws the image i at point p.
If the image needs to be modified to fit in a lower-resolution result (e.g. converting from 32-bit to 8-bit), use the conversion_flags to specify how you'd prefer this to happen.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Draws the image i into the rectangle r. The image will be scaled to fit the rectangle if image and rectangle dimensions differ.
void QPainter::drawImage | ( | const QPoint & | p, |
const QImage & | pm, | ||
const QRect & | sr, | ||
int | conversionFlags = 0 |
||
) | [inline] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Draws the rectangle sr from the image at the given point.
void QPainter::drawImage | ( | int | x, |
int | y, | ||
const QImage & | , | ||
int | sx = 0 , |
||
int | sy = 0 , |
||
int | sw = -1 , |
||
int | sh = -1 , |
||
int | conversionFlags = 0 |
||
) |
void QPainter::drawImage | ( | const QPoint & | , |
const QImage & | , | ||
const QRect & | sr, | ||
int | conversionFlags = 0 |
||
) |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Draws a line from point p1 to point p2.
void QPainter::drawLineSegments | ( | const QPointArray & | a, |
int | index = 0 , |
||
int | nlines = -1 |
||
) |
Draws nlines separate lines from points defined in a, starting at a[index] (index defaults to 0). If nlines is -1 (the defauls) all points until the end of the array are used (i.e. (a.size()-index)/2 lines are drawn).
Draws the 1st line from a[index] to a[index+1]. Draws the 2nd line from a[index+2] to a[index+3] etc.
Draws nlines separate lines from points defined in a, starting at a[index] (index defaults to 0). If nlines is -1 (the default) all points until the end of the array are used (i.e. (a.size()-index)/2 lines are drawn).
Draws the 1st line from a[index] to a[index+1]. Draws the 2nd line from a[index+2] to a[index+3] etc.
void QPainter::drawLineSegments | ( | const QPointArray & | , |
int | index = 0 , |
||
int | nlines = -1 |
||
) |
void QPainter::drawPicture | ( | const QPicture & | pic | ) |
Use one of the other QPainter::drawPicture() functions with a (0, 0) offset instead.
Replays the picture pic translated by (x, y).
This function does exactly the same as QPicture::play() when called with (x, y) = (0, 0).
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Draws picture pic at point p.
void QPainter::drawPicture | ( | const QPicture & | ) |
Draws a pie defined by the rectangle (x,y,w,h), the start angle a and the arc length alen.
The pie is filled with the current brush().
The angles a and alen are 1/16th of a degree, i.e. a full circle equals 5760 (16*360). Positive values of a and alen mean counter-clockwise while negative values mean clockwise direction. Zero degrees is at the 3'o clock position.
Draws a pie defined by the rectangle (x, y, w, h), the start angle a and the arc length alen.
The pie is filled with the current brush().
The angles a and alen are 1/16th of a degree, i.e. a full circle equals 5760 (16*360). Positive values of a and alen mean counter-clockwise while negative values mean the clockwise direction. Zero degrees is at the 3 o'clock position.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Draws a pie segment that fits inside the rectangle r with start angle a and arc length alen.
void QPainter::drawPixmap | ( | int | x, |
int | y, | ||
const QPixmap & | pixmap, | ||
int | sx = 0 , |
||
int | sy = 0 , |
||
int | sw = -1 , |
||
int | sh = -1 |
||
) |
Draws a cubic Bezier curve defined by the control points in a, starting at a[index]. (index defaults to 0.)
Control points after a[index+3] are ignored. Nothing happens if there aren't enough control points.
Draws a pixmap at (x,y) by copying a part of pixmap into the paint device.
(x,y) specify the top-left point in the paint device that is to be drawn onto. (sx,sy) specify the top-left point in pixmap that is to be drawn (the default is (0,0). (sw,sh) specify the size of the pixmap that is to be drawn (the default, (-1,-1), means all the way to the right/bottom of the pixmap).
Draws a pixmap at (x, y) by copying a part of pixmap into the paint device.
(x, y) specifies the top-left point in the paint device that is to be drawn onto. (sx, sy) specifies the top-left point in pixmap that is to be drawn. The default is (0, 0).
(sw, sh) specifies the size of the pixmap that is to be drawn. The default, (-1, -1), means all the way to the bottom right of the pixmap.
Currently the mask of the pixmap or it's alpha channel are ignored when painting on a QPrinter.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Draws the pixmap pm with its origin at point p.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Draws the rectangle sr of pixmap pm with its origin at point p.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Draws the pixmap pm into the rectangle r. The pixmap is scaled to fit the rectangle, if image and rectangle size disagree.
void QPainter::drawPixmap | ( | int | x, |
int | y, | ||
const QPixmap & | , | ||
int | sx = 0 , |
||
int | sy = 0 , |
||
int | sw = -1 , |
||
int | sh = -1 |
||
) |
void QPainter::drawPoint | ( | const QPoint & | p | ) | [inline] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Draws the point p.
void QPainter::drawPoint | ( | const QPoint & | ) |
void QPainter::drawPoints | ( | const QPointArray & | a, |
int | index = 0 , |
||
int | npoints = -1 |
||
) |
Draws/plots an array of points using the current pen.
If index is non-zero (the default is zero) only points from index are drawn. If npoints is negative (the default) the rest of the points from index are drawn. If is is zero or greater, npoints points are drawn.
Draws/plots an array of points, a, using the current pen.
If index is non-zero (the default is zero) only points from index are drawn. If npoints is negative (the default) the rest of the points from index are drawn. If npoints is zero or greater, npoints points are drawn.
void QPainter::drawPoints | ( | const QPointArray & | a, |
int | index = 0 , |
||
int | npoints = -1 |
||
) |
void QPainter::drawPolygon | ( | const QPointArray & | a, |
bool | winding = FALSE , |
||
int | index = 0 , |
||
int | npoints = -1 |
||
) |
Draws the polygon defined by the npoints points in a starting at a[index]. (index defaults to 0.)
If npoints is -1 (the default) all points until the end of the array are used (i.e. a.size()-index line segments define the polygon).
The first point is always connected to the last point.
The polygon is filled with the current brush(). If winding is TRUE, the polygon is filled using the winding fill algorithm. If winding is FALSE, the polygon is filled using the even-odd (alternative) fill algorithm.
Draws the polygon defined by the npoints points in a starting at a[index]. (index defaults to 0.)
If npoints is -1 (the default) all points until the end of the array are used (i.e. a.size()-index line segments define the polygon).
The first point is always connected to the last point.
The polygon is filled with the current brush(). If winding is TRUE, the polygon is filled using the winding fill algorithm. If winding is FALSE, the polygon is filled using the even-odd (alternative) fill algorithm.
void QPainter::drawPolygon | ( | const QPointArray & | , |
bool | winding = FALSE , |
||
int | index = 0 , |
||
int | npoints = -1 |
||
) |
void QPainter::drawPolyline | ( | const QPointArray & | a, |
int | index = 0 , |
||
int | npoints = -1 |
||
) |
Draws the polyline defined by the npoints points in a starting at a[index]. (index defaults to 0.)
If npoints is -1 (the default) all points until the end of the array are used (i.e. a.size()-index-1 line segments are drawn).
Draws the polyline defined by the npoints points in a starting at a[index]. (index defaults to 0.)
If npoints is -1 (the default) all points until the end of the array are used (i.e. a.size()-index-1 line segments are drawn).
void QPainter::drawPolyline | ( | const QPointArray & | , |
int | index = 0 , |
||
int | npoints = -1 |
||
) |
Draws a rectangle with upper left corner at (x,y) and with width w and height h.
Draws a rectangle with upper left corner at (x, y) and with width w and height h.
void QPainter::drawRect | ( | const QRect & | r | ) | [inline] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Draws the rectangle r.
void QPainter::drawRect | ( | const QRect & | ) |
Draws a rectangle with round corners at (x,y), with width w and height h.
The xRnd and yRnd arguments specify how rounded the corners should be. 0 is angled corners, 99 is maximum roundedness.
The width and height include all of the drawn lines.
Draws a rectangle with rounded corners at (x, y), with width w and height h.
The xRnd and yRnd arguments specify how rounded the corners should be. 0 is angled corners, 99 is maximum roundedness.
The width and height include all of the drawn lines.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Draws a rounded rectangle r, rounding to the x position xRnd and the y position yRnd on each corner.
void QPainter::drawText | ( | int | x, |
int | y, | ||
int | w, | ||
int | h, | ||
int | flags, | ||
const QString & | , | ||
int | len = -1 , |
||
QRect * | br = 0 , |
||
QTextParag ** | intern = 0 |
||
) |
void QPainter::drawText | ( | int | x, |
int | y, | ||
const QString & | str, | ||
int | pos, | ||
int | len, | ||
QPainter::TextDirection | dir = Auto |
||
) |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Draws the text from position pos, at point (x, y). If len is -1 the entire string is drawn, otherwise just the first len characters. The text's direction is specified by dir.
Draws at most len characters starting at position pos from the string str to position (x, y).
(x, y) is the base line position. Note that the meaning of y is not the same for the two drawText() varieties.
void QPainter::drawText | ( | const QPoint & | p, |
const QString & | s, | ||
int | len = -1 , |
||
TextDirection | dir = Auto |
||
) | [inline] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Draws the text at the given point.
void QPainter::drawText | ( | int | x, |
int | y, | ||
const QString & | str, | ||
int | len = -1 , |
||
QPainter::TextDirection | dir = Auto |
||
) |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Draws the given text at position x, y. If len is -1 (the default) all the text is drawn, otherwise the first len characters are drawn. The text's direction is given by dir.
Draws at most len characters from str at position (x,y).
(x,y) is the base line position. Note that the meaning of y is not the same for the two drawText() varieties.
Draws at most len characters of the string str at position (x, y).
(x, y) is the base line position. Note that the meaning of y is not the same for the two drawText() varieties.
void QPainter::drawText | ( | int | x, |
int | y, | ||
int | w, | ||
int | h, | ||
int | flags, | ||
const QString & | str, | ||
int | len = -1 , |
||
QRect * | br = 0 , |
||
QTextParag ** | internal = 0 |
||
) | [inline] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Draws the given text within the rectangle starting at x, y, with width w and height h. If len is -1 (the default) all the text is drawn, otherwise the first len characters are drawn. The text's flags that are given in the flags parameter are {Qt::AlignmentFlags} and {Qt::TextFlags} OR'd together. br (if not null) is set to the actual bounding rectangle of the output. The internal parameter is for internal use only.
void QPainter::drawText | ( | const QRect & | r, |
int | tf, | ||
const QString & | str, | ||
int | len = -1 , |
||
QRect * | brect = 0 , |
||
QTextParag ** | internal = 0 |
||
) |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Draws at most len characters from str in the rectangle r.
This function draws formatted text. The tf text format is really of type Qt::AlignmentFlags and Qt::TextFlags OR'd together.
Horizontal alignment defaults to AlignAuto and vertical alignment defaults to AlignTop.
brect (if not null) is set to the actual bounding rectangle of the output. internal is, yes, internal.
void QPainter::drawText | ( | int | x, |
int | y, | ||
const QString & | , | ||
int | len = -1 , |
||
TextDirection | dir = Auto |
||
) |
void QPainter::drawText | ( | const QPoint & | , |
const QString & | , | ||
int | len = -1 , |
||
TextDirection | dir = Auto |
||
) |
void QPainter::drawText | ( | int | x, |
int | y, | ||
const QString & | , | ||
int | pos, | ||
int | len, | ||
TextDirection | dir = Auto |
||
) |
void QPainter::drawText | ( | const QPoint & | p, |
const QString & | s, | ||
int | pos, | ||
int | len, | ||
TextDirection | dir = Auto |
||
) | [inline] |
Draws the text from position pos, at point p. If len is -1 the entire string is drawn, otherwise just the first len characters. The text's direction is specified by dir.
Note that the meaning of y is not the same for the two drawText() varieties. For overloads that take a simple x, y pair (or a point), the y value is the text's baseline; for overloads that take a rectangle, rect.y() is the top of the rectangle and the text is aligned within that rectangle in accordance with the alignment flags.
void QPainter::drawText | ( | const QPoint & | p, |
const QString & | , | ||
int | pos, | ||
int | len, | ||
TextDirection | dir = Auto |
||
) |
void QPainter::drawText | ( | const QRect & | , |
int | flags, | ||
const QString & | , | ||
int | len = -1 , |
||
QRect * | br = 0 , |
||
QTextParag ** | intern = 0 |
||
) |
void QPainter::drawTiledPixmap | ( | int | x, |
int | y, | ||
int | w, | ||
int | h, | ||
const QPixmap & | , | ||
int | sx = 0 , |
||
int | sy = 0 |
||
) |
void QPainter::drawTiledPixmap | ( | int | x, |
int | y, | ||
int | w, | ||
int | h, | ||
const QPixmap & | pixmap, | ||
int | sx = 0 , |
||
int | sy = 0 |
||
) |
Draws a tiled pixmap in the specified rectangle.
(x,y) specify the top-left point in the paint device that is to be drawn onto. (sx,sy) specify the top-left point in pixmap that is to be drawn (the default is (0,0).
Calling drawTiledPixmap() is similar to calling drawPixmap() several times to fill (tile) an area with a pixmap, but is potentially much more efficient depending on the underlying window system.
Draws a tiled pixmap in the specified rectangle.
(x, y) specifies the top-left point in the paint device that is to be drawn onto; with the width and height given by w and h. (sx, sy) specifies the top-left point in pixmap that is to be drawn. The default is (0, 0).
Calling drawTiledPixmap() is similar to calling drawPixmap() several times to fill (tile) an area with a pixmap, but is potentially much more efficient depending on the underlying window system.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Draws a tiled pixmap, pm, inside rectangle r.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Draws a tiled pixmap, pm, inside rectangle r with its origin at point sp.
Draws a Windows focus rectangle with upper left corner at (x,y) and with width w and height h using a pen color that contrasts with bgColor.
This function draws a stippled rectangle (XOR is not used) that is used to indicate keyboard focus (when the QApplication::style() is WindowStyle
).
The pen color used to draw the rectangle is either white or black depending on the color of bgColor (see QColor::gray()).
Draws a Windows focus rectangle with upper left corner at (x, y) and with width w and height h using a pen color that contrasts with bgColor.
This function draws a stippled rectangle (XOR is not used) that is used to indicate keyboard focus (when the QApplication::style() is WindowStyle
).
The pen color used to draw the rectangle is either white or black depending on the color of bgColor (see QColor::gray()).
void QPainter::drawWinFocusRect | ( | const QRect & | r | ) | [inline] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Draws rectangle r as a window focus rectangle.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Draws rectangle r as a window focus rectangle using background color bgColor.
Draws a Windows focus rectangle with upper left corner at (x,y) and with width w and height h.
This function draws a stippled XOR rectangle that is used to indicate keyboard focus (when QApplication::style() is WindowStyle
).
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Draws a Windows focus rectangle with upper left corner at (x, y) and with width w and height h.
This function draws a stippled XOR rectangle that is used to indicate keyboard focus (when QApplication::style() is WindowStyle
).
void QPainter::drawWinFocusRect | ( | const QRect & | ) |
bool QPainter::end | ( | ) |
bool QPainter::end | ( | ) |
Ends painting. Any resources used while painting are released.
Note that while you mostly don't need to call end(), the destructor will do it, there is at least one common case, namely double buffering.
QPainter p( myPixmap, this ) // ... p.end(); // stops drawing on myPixmap p.begin( this ); p.drawPixmap( myPixmap );
Since you can't draw a QPixmap while it is being painted, it is necessary to close the active painter.
Ends painting. Any resources used while painting are released.
Note that while you mostly don't need to call end(), the destructor will do it, there is at least one common case when it is needed, namely double buffering.
QPainter p( myPixmap, this ) // ... p.end(); // stops drawing on myPixmap p.begin( this ); p.drawPixmap( 0, 0, myPixmap );
Since you can't draw a QPixmap while it is being painted, it is necessary to close the active painter.
void QPainter::eraseRect | ( | const QRect & | ) |
Erases the area inside x, y, w, h. Equivalent to {fillRect( x, y, w, h, backgroundColor() )}.
void QPainter::eraseRect | ( | const QRect & | r | ) | [inline] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Erases the area inside the rectangle r.
Fills the rectangle (x, y, w, h) with the brush.
You can specify a QColor as brush, since there is a QBrush constructor that takes a QColor argument and creates a solid pattern brush.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Fills the rectangle r using brush brush.
void QPainter::flush | ( | const QRegion & | region, |
CoordinateMode | cm = CoordDevice |
||
) |
Flushes any buffered drawing operations inside the region region using clipping mode cm.
The flush may update the whole device if the platform does not support flushing to a specified region.
void QPainter::flush | ( | const QRegion & | region, |
CoordinateMode | cm = CoordDevice |
||
) |
void QPainter::flush | ( | ) |
void QPainter::flush | ( | ) |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Flushes any buffered drawing operations.
const QFont& QPainter::font | ( | ) | const |
const QFont & QPainter::font | ( | ) | const [inline] |
QFontInfo QPainter::fontInfo | ( | ) | const |
QFontInfo QPainter::fontInfo | ( | ) | const |
Returns the font info for the painter, if the painter is active. It is not possible to obtain font information for an inactive painter, so the return value is undefined if the painter is not active.
QFontMetrics QPainter::fontMetrics | ( | ) | const |
QFontMetrics QPainter::fontMetrics | ( | ) | const |
Returns the font metrics for the painter, if the painter is active. It is not possible to obtain metrics for an inactive painter, so the return value is undefined if the painter is not active.
bool QPainter::hasClipping | ( | ) | const [inline] |
Returns TRUE if clipping has been set; otherwise returns FALSE.
bool QPainter::hasClipping | ( | ) | const |
bool QPainter::hasViewXForm | ( | ) | const [inline] |
Returns TRUE if view transformation is enabled; otherwise returns FALSE.
bool QPainter::hasViewXForm | ( | ) | const |
bool QPainter::hasWorldXForm | ( | ) | const [inline] |
Returns TRUE if world transformation is enabled; otherwise returns FALSE.
bool QPainter::hasWorldXForm | ( | ) | const |
void QPainter::initialize | ( | ) | [static] |
Internal function that initializes the painter.
static void QPainter::initialize | ( | ) | [static] |
bool QPainter::isActive | ( | ) | const |
bool QPainter::isActive | ( | ) | const [inline] |
Returns TRUE if the painter is active painting, i.e. begin() has been called and end() has not yet been called; otherwise returns FALSE.
Draws a line from the current pen position to (x,y) and sets (x,y) to be the new current pen position.
Use drawLine() instead.
Draws a line from the current pen position to (x, y) and sets (x, y) to be the new current pen position.
void QPainter::lineTo | ( | const QPoint & | p | ) | [inline] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Draws a line to the point p.
void QPainter::lineTo | ( | const QPoint & | ) |
void QPainter::moveTo | ( | const QPoint & | p | ) | [inline] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Moves to the point p.
void QPainter::moveTo | ( | const QPoint & | ) |
const QPen& QPainter::pen | ( | ) | const |
const QPen & QPainter::pen | ( | ) | const [inline] |
Returns the painter's current pen.
QPoint QPainter::pos | ( | ) | const |
QPoint QPainter::pos | ( | ) | const |
Qt::RasterOp QPainter::rasterOp | ( | ) | const [inline] |
Returns the current raster operation .
RasterOp QPainter::rasterOp | ( | ) | const |
static void QPainter::redirect | ( | QPaintDevice * | pdev, |
QPaintDevice * | replacement | ||
) | [static] |
static QPaintDevice* QPainter::redirect | ( | QPaintDevice * | pdev | ) | [static] |
void QPainter::redirect | ( | QPaintDevice * | pdev, |
QPaintDevice * | replacement | ||
) | [static] |
Redirects all paint commands for a paint device, pdev, to another paint device, replacement, unless replacement is 0. If replacement is 0, the redirection for pdev is removed.
In general, you'll probably find calling QPixmap::grabWidget() or QPixmap::grabWindow() is an easier solution.
QPaintDevice * QPainter::redirect | ( | QPaintDevice * | pdev | ) | [static] |
void QPainter::resetXForm | ( | ) |
void QPainter::resetXForm | ( | ) |
Resets any transformations that were made using translate(), scale(), shear(), rotate(), setWorldMatrix(), setViewport() and setWindow().
void QPainter::restore | ( | ) |
Restores the current painter state (pops a saved state off the stack).
void QPainter::restore | ( | ) |
void QPainter::restoreWorldMatrix | ( | ) |
void QPainter::restoreWorldMatrix | ( | ) |
We recommend using restore() instead.
void QPainter::rotate | ( | double | a | ) |
void QPainter::rotate | ( | double | a | ) |
Rotates the coordinate system a degrees counterclockwise.
void QPainter::save | ( | const QString & | id = QString::null | ) |
void QPainter::save | ( | const QString & | id = QString::null | ) |
void QPainter::saveWorldMatrix | ( | ) |
We recommend using save() instead.
void QPainter::saveWorldMatrix | ( | ) |
void QPainter::scale | ( | double | sx, |
double | sy | ||
) |
void QPainter::scale | ( | double | sx, |
double | sy | ||
) |
Scales the coordinate system by (sx, sy).
void QPainter::setBackgroundColor | ( | const QColor & | c | ) |
Sets the background color of the painter to c.
The background color is the color that is filled in when drawing opaque text, stippled lines and bitmaps. The background color has no effect in transparent background mode (which is the default).
void QPainter::setBackgroundColor | ( | const QColor & | ) |
void QPainter::setBackgroundMode | ( | BGMode | ) |
void QPainter::setBackgroundMode | ( | BGMode | m | ) |
Sets the background mode of the painter to m, which must be one of TransparentMode
(the default) and OpaqueMode
.
Transparent mode draws stippled lines and text without setting the background pixels. Opaque mode fills these space with the current background color.
Note that in order to draw a bitmap or pixmap transparently, you must use QPixmap::setMask().
Sets the background mode of the painter to m, which must be either TransparentMode
(the default) or OpaqueMode
.
Transparent mode draws stippled lines and text without setting the background pixels. Opaque mode fills these space with the current background color.
Note that in order to draw a bitmap or pixmap transparently, you must use QPixmap::setMask().
void QPainter::setBrush | ( | const QBrush & | ) |
void QPainter::setBrush | ( | BrushStyle | ) |
void QPainter::setBrush | ( | const QColor & | ) |
void QPainter::setBrush | ( | const QBrush & | brush | ) |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Sets the painter's brush to brush.
The brush defines how shapes are filled.
void QPainter::setBrush | ( | const QColor & | color | ) |
void QPainter::setBrush | ( | BrushStyle | style | ) |
Sets the brush origin to (x,y).
The brush origin specifies the (0,0) coordinate of the painter's brush. This setting only applies to pattern brushes and pixmap brushes.
Sets the brush origin to (x, y).
The brush origin specifies the (0, 0) coordinate of the painter's brush. This setting only applies to pattern brushes and pixmap brushes.
void QPainter::setBrushOrigin | ( | const QPoint & | p | ) | [inline] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Sets the brush origin to point p.
void QPainter::setBrushOrigin | ( | const QPoint & | ) |
void QPainter::setClipping | ( | bool | ) |
void QPainter::setClipping | ( | bool | enable | ) |
Enables clipping if enable is TRUE, or disables clipping if enable is FALSE.
void QPainter::setClipRect | ( | int | x, |
int | y, | ||
int | w, | ||
int | h, | ||
CoordinateMode | m = CoordDevice |
||
) | [inline] |
Sets the clip region to the rectangle x, y, w, h and enables clipping. The clip mode is set to m.
If m is CoordDevice
(the default), the coordinates given for the clip region are taken to be physical device coordinates and are not subject to any coordinate transformations. If m is CoordPainter
, the coordinates given for the clip region are taken to be model coordinates.
void QPainter::setClipRect | ( | const QRect & | r, |
CoordinateMode | m = CoordDevice |
||
) |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Sets the clip region to the rectangle r and enables clipping. The clip mode is set to m.
void QPainter::setClipRect | ( | const QRect & | , |
CoordinateMode | = CoordDevice |
||
) |
void QPainter::setClipRect | ( | int | x, |
int | y, | ||
int | w, | ||
int | h, | ||
CoordinateMode | = CoordDevice |
||
) |
void QPainter::setClipRegion | ( | const QRegion & | rgn, |
CoordinateMode | m = CoordDevice |
||
) |
Sets the clip region to rgn and enables clipping.
Note that the clip region is given in physical device coordinates and not subject to any coordinate transformation.
Sets the clip region to rgn and enables clipping. The clip mode is set to m.
Note that the clip region is given in physical device coordinates and not subject to any coordinate transformation.
void QPainter::setClipRegion | ( | const QRegion & | , |
CoordinateMode | = CoordDevice |
||
) |
void QPainter::setFont | ( | const QFont & | ) |
void QPainter::setFont | ( | const QFont & | font | ) |
Sets a new painter font.
This font is used by subsequent drawText() functions. The text color is the same as the pen color.
Sets the painter's font to font.
This font is used by subsequent drawText() functions. The text color is the same as the pen color.
void QPainter::setPen | ( | const QPen & | pen | ) |
Sets a new painter pen.
The pen defines how to draw lines and outlines, and it also defines the text color.
void QPainter::setPen | ( | const QColor & | color | ) |
void QPainter::setPen | ( | const QColor & | ) |
void QPainter::setPen | ( | PenStyle | ) |
void QPainter::setPen | ( | const QPen & | ) |
void QPainter::setPen | ( | PenStyle | style | ) |
void QPainter::setRasterOp | ( | RasterOp | r | ) |
Sets the raster operation to r. The default is CopyROP
.
Sets the raster operation to r. The default is CopyROP
.
void QPainter::setRasterOp | ( | RasterOp | ) |
void QPainter::setTabArray | ( | int * | ta | ) |
Sets the tab stop array to ta. This puts tab stops at ta[0], ta[1] and so on. The array is null-terminated.
If both a tab array and a tab top size is set, the tab array wins.
void QPainter::setTabArray | ( | int * | ) |
void QPainter::setTabStops | ( | int | ts | ) |
Set the tab stop width to ts, i.e. locates tab stops at ts, 2*ts, 3*ts and so on.
Tab stops are used when drawing formatted text with ExpandTabs
set. This fixed tab stop value is used only if no tab array is set (which is the default case).
A value of 0 (the default) implies a tabstop setting of 8 times the width of the character 'x' in the font currently set on the painter.
void QPainter::setTabStops | ( | int | ) |
Sets the viewport rectangle view transformation for the painter and enables view transformation.
The viewport rectangle is part of the view transformation. The viewport specifies the device coordinate system and is specified by the x, y, w width and h height parameters. Its sister, the window(), specifies the logical coordinate system.
The default viewport rectangle is the same as the device's rectangle. See the Coordinate System Overview for an overview of coordinate transformation.
void QPainter::setViewport | ( | const QRect & | ) |
void QPainter::setViewport | ( | const QRect & | r | ) | [inline] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Sets the painter's viewport to rectangle r.
void QPainter::setViewXForm | ( | bool | enable | ) |
Enables view transformations if enable is TRUE, or disables view transformations if enable is FALSE.
void QPainter::setViewXForm | ( | bool | ) |
void QPainter::setWindow | ( | const QRect & | ) |
Sets the window rectangle view transformation for the painter and enables view transformation.
The window rectangle is part of the view transformation. The window specifies the logical coordinate system and is specified by the x, y, w width and h height parameters. Its sister, the viewport(), specifies the device coordinate system.
The default window rectangle is the same as the device's rectangle. See the Coordinate System Overview for an overview of coordinate transformation.
void QPainter::setWindow | ( | const QRect & | r | ) | [inline] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Sets the painter's window to rectangle r.
Sets the world transformation matrix to m and enables world transformation.
If combine is TRUE, then m is combined with the current transformation matrix, otherwise m replaces the current transformation matrix.
If m is the identity matrix and combine is FALSE, this function calls setWorldXForm(FALSE). (The identity matrix is the matrix where QWMatrix::m11() and QWMatrix::m22() are 1.0 and the rest are 0.0.)
World transformations are applied after the view transformations (i.e. window and viewport).
The following functions can transform the coordinate system without using a QWMatrix: translate() scale() shear() rotate()
They operate on the painter's worldMatrix() and are implemented like this:
void QPainter::rotate( double a ) { QWMatrix m; m.rotate( a ); setWorldMatrix( m, TRUE ); }
Note that you should always use combine when you are drawing into a QPicture. Otherwise it may not be possible to replay the picture with additional transformations. Using translate(), scale(), etc., is safe.
For a brief overview of coordinate transformation, see the Coordinate System Overview.
void QPainter::setWorldXForm | ( | bool | ) |
void QPainter::setWorldXForm | ( | bool | enable | ) |
Enables world transformations if enable is TRUE, or disables world transformations if enable is FALSE. The world transformation matrix is not changed.
void QPainter::shear | ( | double | sh, |
double | sv | ||
) |
void QPainter::shear | ( | double | sh, |
double | sv | ||
) |
Shears the coordinate system by (sh, sv).
int * QPainter::tabArray | ( | ) | const [inline] |
Returns the currently set tab stop array.
int* QPainter::tabArray | ( | ) | const |
int QPainter::tabStops | ( | ) | const [inline] |
Returns the tab stop setting.
int QPainter::tabStops | ( | ) | const |
void QPainter::translate | ( | double | dx, |
double | dy | ||
) |
Translates the coordinate system by (dx, dy). After this call, (dx, dy) is added to points.
For example, the following code draws the same point twice:
void MyWidget::paintEvent() { QPainter paint( this ); paint.drawPoint( 0, 0 ); paint.translate( 100.0, 40.0 ); paint.drawPoint( -100, -40 ); }
void QPainter::translate | ( | double | dx, |
double | dy | ||
) |
double QPainter::translationX | ( | ) | const |
double QPainter::translationX | ( | ) | const [inline] |
double QPainter::translationY | ( | ) | const [inline] |
double QPainter::translationY | ( | ) | const |
QRect QPainter::viewport | ( | ) | const |
QRect QPainter::viewport | ( | ) | const |
Returns the viewport rectangle.
QRect QPainter::window | ( | ) | const |
QRect QPainter::window | ( | ) | const |
Returns the window rectangle.
const QWMatrix& QPainter::worldMatrix | ( | ) | const |
const QWMatrix & QPainter::worldMatrix | ( | ) | const |
Returns the world transformation matrix.
QPointArray QPainter::xForm | ( | const QPointArray & | av | ) | const |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Returns the point array av transformed from model coordinates to device coordinates.
QPointArray QPainter::xForm | ( | const QPointArray & | av, |
int | index, | ||
int | npoints | ||
) | const |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Returns the point array av transformed from model coordinates to device coordinates. The index is the first point in the array and npoints denotes the number of points to be transformed. If npoints is negative, all points from av[index] until the last point in the array are transformed.
The returned point array consists of the number of points that were transformed.
Example:
QPointArray a(10); QPointArray b; b = painter.xForm(a, 2, 4); // b.size() == 4 b = painter.xForm(a, 2, -1); // b.size() == 8
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Returns the rectangle rv transformed from model coordinates to device coordinates.
If world transformation is enabled and rotation or shearing has been specified, then the bounding rectangle is returned.
Returns the point pv transformed from model coordinates to device coordinates.
QPointArray QPainter::xForm | ( | const QPointArray & | ) | const |
QPointArray QPainter::xForm | ( | const QPointArray & | , |
int | index, | ||
int | npoints | ||
) | const |
QPointArray QPainter::xFormDev | ( | const QPointArray & | ) | const |
QPointArray QPainter::xFormDev | ( | const QPointArray & | ad, |
int | index, | ||
int | npoints | ||
) | const |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Returns the point array ad transformed from device coordinates to model coordinates. The index is the first point in the array and npoints denotes the number of points to be transformed. If npoints is negative, all points from ad[index] until the last point in the array are transformed.
The returned point array consists of the number of points that were transformed.
Example:
QPointArray a(10); QPointArray b; b = painter.xFormDev(a, 1, 3); // b.size() == 3 b = painter.xFormDev(a, 1, -1); // b.size() == 9
QPointArray QPainter::xFormDev | ( | const QPointArray & | ad | ) | const |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Returns the point array ad transformed from device coordinates to model coordinates.
QPointArray QPainter::xFormDev | ( | const QPointArray & | , |
int | index, | ||
int | npoints | ||
) | const |
Returns the rectangle rd transformed from device coordinates to model coordinates.
If world transformation is enabled and rotation or shearing is used, then the bounding rectangle is returned.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Returns the point pd transformed from device coordinates to model coordinates.
void qDrawPlainRect | ( | QPainter * | p, |
int | x, | ||
int | y, | ||
int | w, | ||
int | h, | ||
const QColor & | c, | ||
int | lineWidth, | ||
const QBrush * | fill | ||
) | [related] |
{#include <qdrawutil.h>}
Draws the plain rectangle specified by (x, y, w, h) using the painter p.
The color argument c specifies the line color.
The lineWidth argument specifies the line width.
The rectangle's interior is filled with the fill brush unless fill is 0.
If you want to use a QFrame widget instead, you can make it display a plain rectangle, for example {QFrame::setFrameStyle( QFrame::Box | QFrame::Plain )}.
void qDrawPlainRect | ( | QPainter * | p, |
const QRect & | r, | ||
const QColor & | c, | ||
int | lineWidth, | ||
const QBrush * | fill | ||
) | [related] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
void qDrawShadeLine | ( | QPainter * | p, |
const QPoint & | p1, | ||
const QPoint & | p2, | ||
const QColorGroup & | g, | ||
bool | sunken, | ||
int | lineWidth, | ||
int | midLineWidth | ||
) | [related] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
void qDrawShadeLine | ( | QPainter * | p, |
int | x1, | ||
int | y1, | ||
int | x2, | ||
int | y2, | ||
const QColorGroup & | g, | ||
bool | sunken, | ||
int | lineWidth, | ||
int | midLineWidth | ||
) | [related] |
{#include <qdrawutil.h>}
Draws a horizontal (y1 == y2) or vertical (x1 == x2) shaded line using the painter p.
Nothing is drawn if y1 != y2 and x1 != x2 (i.e. the line is neither horizontal nor vertical).
The color group argument g specifies the shading colors (light, dark and middle colors).
The line appears sunken if sunken is TRUE, or raised if sunken is FALSE.
The lineWidth argument specifies the line width for each of the lines. It is not the total line width.
The midLineWidth argument specifies the width of a middle line drawn in the QColorGroup::mid() color.
If you want to use a QFrame widget instead, you can make it display a shaded line, for example {QFrame::setFrameStyle( QFrame::HLine | QFrame::Sunken )}.
void qDrawShadePanel | ( | QPainter * | p, |
const QRect & | r, | ||
const QColorGroup & | g, | ||
bool | sunken, | ||
int | lineWidth, | ||
const QBrush * | fill | ||
) | [related] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
void qDrawShadePanel | ( | QPainter * | p, |
int | x, | ||
int | y, | ||
int | w, | ||
int | h, | ||
const QColorGroup & | g, | ||
bool | sunken, | ||
int | lineWidth, | ||
const QBrush * | fill | ||
) | [related] |
{#include <qdrawutil.h>}
Draws the shaded panel specified by (x, y, w, h) using the painter p.
The color group argument g specifies the shading colors (light, dark and middle colors).
The panel appears sunken if sunken is TRUE, or raised if sunken is FALSE.
The lineWidth argument specifies the line width.
The panel's interior is filled with the fill brush unless fill is 0.
If you want to use a QFrame widget instead, you can make it display a shaded panel, for example {QFrame::setFrameStyle( QFrame::Panel | QFrame::Sunken )}.
void qDrawShadeRect | ( | QPainter * | p, |
const QRect & | r, | ||
const QColorGroup & | g, | ||
bool | sunken, | ||
int | lineWidth, | ||
int | midLineWidth, | ||
const QBrush * | fill | ||
) | [related] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
void qDrawShadeRect | ( | QPainter * | p, |
int | x, | ||
int | y, | ||
int | w, | ||
int | h, | ||
const QColorGroup & | g, | ||
bool | sunken, | ||
int | lineWidth, | ||
int | midLineWidth, | ||
const QBrush * | fill | ||
) | [related] |
{#include <qdrawutil.h>}
Draws the shaded rectangle specified by (x, y, w, h) using the painter p.
The color group argument g specifies the shading colors (light, dark and middle colors).
The rectangle appears sunken if sunken is TRUE, or raised if sunken is FALSE.
The lineWidth argument specifies the line width for each of the lines. It is not the total line width.
The midLineWidth argument specifies the width of a middle line drawn in the QColorGroup::mid() color.
The rectangle's interior is filled with the fill brush unless fill is 0.
If you want to use a QFrame widget instead, you can make it display a shaded rectangle, for example {QFrame::setFrameStyle( QFrame::Box | QFrame::Raised )}.
void qDrawWinButton | ( | QPainter * | p, |
const QRect & | r, | ||
const QColorGroup & | g, | ||
bool | sunken, | ||
const QBrush * | fill | ||
) | [related] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
void qDrawWinButton | ( | QPainter * | p, |
int | x, | ||
int | y, | ||
int | w, | ||
int | h, | ||
const QColorGroup & | g, | ||
bool | sunken, | ||
const QBrush * | fill | ||
) | [related] |
{#include <qdrawutil.h>}
Draws the Windows-style button specified by (x, y, w, h) using the painter p.
The color group argument g specifies the shading colors (light, dark and middle colors).
The button appears sunken if sunken is TRUE, or raised if sunken is FALSE.
The line width is 2 pixels.
The button's interior is filled with the *fill brush unless fill is 0.
void qDrawWinPanel | ( | QPainter * | p, |
const QRect & | r, | ||
const QColorGroup & | g, | ||
bool | sunken, | ||
const QBrush * | fill | ||
) | [related] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
void qDrawWinPanel | ( | QPainter * | p, |
int | x, | ||
int | y, | ||
int | w, | ||
int | h, | ||
const QColorGroup & | g, | ||
bool | sunken, | ||
const QBrush * | fill | ||
) | [related] |
{#include <qdrawutil.h>}
Draws the Windows-style panel specified by (x, y, w, h) using the painter p.
The color group argument g specifies the shading colors.
The panel appears sunken if sunken is TRUE, or raised if sunken is FALSE.
The line width is 2 pixels.
The button's interior is filled with the fill brush unless fill is 0.
If you want to use a QFrame widget instead, you can make it display a shaded panel, for example {QFrame::setFrameStyle( QFrame::WinPanel | QFrame::Raised )}.
QFontInfo [friend] |
QFontMetrics [friend] |
QPrinter [friend] |
void qt_format_text | ( | const QFont & | , |
const QRect & | r, | ||
int | tf, | ||
const QString & | str, | ||
int | len, | ||
QRect * | brect, | ||
int | tabstops, | ||
int * | tabarray, | ||
int | tabarraylen, | ||
QTextParag ** | internal, | ||
QPainter * | painter | ||
) | [friend] |
void qt_format_text | ( | const QFont & | , |
const QRect & | r, | ||
int | tf, | ||
const QString & | str, | ||
int | len, | ||
QRect * | brect, | ||
int | tabstops, | ||
int * | tabarray, | ||
int | tabarraylen, | ||
QTextParag ** | internal, | ||
QPainter * | painter | ||
) | [friend] |
QTextLayout [friend] |