Eneboo - Documentación para desarrolladores
Tipos públicos | Métodos públicos | Métodos públicos estáticos | Amigas | Funciones relacionadas
Referencia de la Clase QPainter

The QPainter class does low-level painting e.g. on widgets. Más...

#include <qpainter.h>

Diagrama de herencias de QPainter
Qt Qt

Lista de todos los miembros.

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 ()
QPaintDevicedevice () const
bool isActive () const
void flush (const QRegion &region, CoordinateMode cm=CoordDevice)
void flush ()
void save (const QString &id=QString::null)
void restore ()
QFontMetrics fontMetrics () const
QFontInfo fontInfo () const
const QFontfont () const
void setFont (const QFont &)
const QPenpen () const
void setPen (const QPen &)
void setPen (PenStyle)
void setPen (const QColor &)
const QBrushbrush () const
void setBrush (const QBrush &)
void setBrush (BrushStyle)
void setBrush (const QColor &)
QPoint pos () const
const QColorbackgroundColor () const
void setBackgroundColor (const QColor &)
BGMode backgroundMode () const
void setBackgroundMode (BGMode)
RasterOp rasterOp () const
void setRasterOp (RasterOp)
const QPointbrushOrigin () 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 QWMatrixworldMatrix () 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)
inttabArray () 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 ()
QPaintDevicedevice () const
bool isActive () const
void flush (const QRegion &region, CoordinateMode cm=CoordDevice)
void flush ()
void save (const QString &id=QString::null)
void restore ()
QFontMetrics fontMetrics () const
QFontInfo fontInfo () const
const QFontfont () const
void setFont (const QFont &)
const QPenpen () const
void setPen (const QPen &)
void setPen (PenStyle)
void setPen (const QColor &)
const QBrushbrush () const
void setBrush (const QBrush &)
void setBrush (BrushStyle)
void setBrush (const QColor &)
QPoint pos () const
const QColorbackgroundColor () const
void setBackgroundColor (const QColor &)
BGMode backgroundMode () const
void setBackgroundMode (BGMode)
RasterOp rasterOp () const
void setRasterOp (RasterOp)
const QPointbrushOrigin () 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 QWMatrixworldMatrix () 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)
inttabArray () const
void setTabArray (int *)

Métodos públicos estáticos

static void redirect (QPaintDevice *pdev, QPaintDevice *replacement)
static QPaintDeviceredirect (QPaintDevice *pdev)
static void initialize ()
static void cleanup ()
static void redirect (QPaintDevice *pdev, QPaintDevice *replacement)
static QPaintDeviceredirect (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

Descripción detallada

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.

Atención:
Note that QPainter does not attempt to work around coordinate limitations in the underlying window system. Some platforms may behave incorrectly with coordinates as small as +/-4000.
Ver también:
QPaintDevice QWidget QPixmap QPrinter QPicture Application Walkthrough Coordinate System Overview

Documentación de las enumeraciones miembro de la clase

CoordDevice CoordPainter

Ver también:
clipRegion()
Valores de enumeraciones:
CoordDevice 
CoordPainter 
CoordDevice 
CoordPainter 
Valores de enumeraciones:
CoordDevice 
CoordPainter 
CoordDevice 
CoordPainter 
Valores de enumeraciones:
Auto 
RTL 
LTR 
Auto 
RTL 
LTR 

Auto RTL right to left LTR left to right

Ver también:
drawText()
Valores de enumeraciones:
Auto 
RTL 
LTR 
Auto 
RTL 
LTR 

Documentación del constructor y destructor

QPainter::QPainter ( )

Constructs a painter.

Notice that all painter settings (setPen, setBrush etc.) are reset to default values when begin() is called.

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

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

Ver también:
begin()
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 ( )

Documentación de las funciones miembro

const QColor & QPainter::backgroundColor ( ) const [inline]

Returns the current background color.

Ver también:
setBackgroundColor() QColor
const QColor& QPainter::backgroundColor ( ) const
BGMode QPainter::backgroundMode ( ) const
Qt::BGMode QPainter::backgroundMode ( ) const [inline]

Returns the current background mode.

Ver también:
setBackgroundMode() BGMode
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);
  }
Ver también:
end()
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.

Atención:
A paint device can only be painted by one painter at a time.
Ver también:
end(), flush()

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.

Atención:
A paint device can only be painted by one painter at a time.
Ver también:
end(), flush()
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.

Ver también:
Qt::TextFlags
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.

Ver también:
drawText(), fontMetrics(), QFontMetrics::boundingRect(), Qt::TextFlags
const QBrush& QPainter::brush ( ) const
const QBrush & QPainter::brush ( ) const [inline]

Returns the painter's current brush.

Ver también:
QPainter::setBrush()
const QPoint& QPainter::brushOrigin ( ) const
const QPoint & QPainter::brushOrigin ( ) const [inline]

Returns the brush origin currently set.

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

Ver también:
setClipRegion(), setClipRect(), setClipping() QPainter::CoordinateMode
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.

Ver también:
QPaintDevice::paintingActive()
QPaintDevice* QPainter::device ( ) const
void QPainter::drawArc ( int  x,
int  y,
int  w,
int  h,
int  a,
int  alen 
)

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:

    QPainter p( myWidget );
    p.drawArc( 10,10, 70,100, 100*16, 160*16 ); // draws a "(" arc
Ver también:
drawPie(), drawChord()

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:

        QPainter p( myWidget );
        p.drawArc( 10,10, 70,100, 100*16, 160*16 ); // draws a "(" arc
Ver también:
drawPie(), drawChord()
void QPainter::drawArc ( const QRect r,
int  a,
int  alen 
) [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 arc that fits inside the rectangle r with start angle a and arc length alen.

void QPainter::drawArc ( int  x,
int  y,
int  w,
int  h,
int  a,
int  alen 
)
void QPainter::drawArc ( const QRect ,
int  a,
int  alen 
)
void QPainter::drawChord ( int  x,
int  y,
int  w,
int  h,
int  a,
int  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.

Ver también:
drawArc(), drawPie()

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.

Ver también:
drawArc(), drawPie()
void QPainter::drawChord ( const QRect r,
int  a,
int  alen 
) [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 chord that fits inside the rectangle r with start angle a and arc length alen.

void QPainter::drawChord ( int  x,
int  y,
int  w,
int  h,
int  a,
int  alen 
)
void QPainter::drawChord ( const QRect ,
int  a,
int  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().

Atención:
On X11, coordinates that do not fit into 16-bit signed values are truncated. This limitation is expected to go away in Qt 4.
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.

Atención:
On X11, coordinates that do not fit into 16-bit signed values are truncated. This limitation is expected to go away in Qt 4.
void QPainter::drawCubicBezier ( const QPointArray ,
int  index = 0 
)
void QPainter::drawEllipse ( int  x,
int  y,
int  w,
int  h 
)

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 ( int  x,
int  y,
int  w,
int  h 
)
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.

Ver también:
drawPixmap() QPixmap::convertFromImage()
void QPainter::drawImage ( const QPoint p,
const QImage i,
int  conversion_flags = 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 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.

Ver también:
Qt::ImageConversionFlags
void QPainter::drawImage ( const QRect r,
const QImage i 
)

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 
)
void QPainter::drawImage ( const QPoint ,
const QImage ,
int  conversion_flags = 0 
)
void QPainter::drawImage ( const QRect ,
const QImage  
)
void QPainter::drawLine ( const QPoint p1,
const QPoint p2 
) [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 from point p1 to point p2.

void QPainter::drawLine ( int  x1,
int  y1,
int  x2,
int  y2 
)

Draws a line from (x1,y2) to (x2,y2) and sets (x2,y2) to be the new current pen position.

Ver también:
QPen

Draws a line from (x1, y1) to (x2, y2) and sets the current pen position to (x2, y2).

Ver también:
pen()
void QPainter::drawLine ( int  x1,
int  y1,
int  x2,
int  y2 
)
void QPainter::drawLine ( const QPoint ,
const QPoint  
)
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.

Ver también:
drawPolyline(), drawPolygon(), QPen

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.

Atención:
On X11, coordinates that do not fit into 16-bit signed values are truncated. This limitation is expected to go away in Qt 4.
Ver también:
drawPolyline(), drawPolygon(), QPen
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.

void QPainter::drawPicture ( int  x,
int  y,
const QPicture pic 
)

Replays the picture pic translated by (x, y).

This function does exactly the same as QPicture::play() when called with (x, y) = (0, 0).

void QPainter::drawPicture ( const QPoint p,
const QPicture pic 
)

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 )
void QPainter::drawPicture ( int  x,
int  y,
const QPicture  
)
void QPainter::drawPicture ( const QPoint ,
const QPicture  
)
void QPainter::drawPie ( int  x,
int  y,
int  w,
int  h,
int  a,
int  alen 
)

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.

Ver también:
drawArc(), drawChord()

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.

Ver también:
drawArc(), drawChord()
void QPainter::drawPie ( const QRect r,
int  a,
int  alen 
) [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 pie segment that fits inside the rectangle r with start angle a and arc length alen.

void QPainter::drawPie ( int  x,
int  y,
int  w,
int  h,
int  a,
int  alen 
)
void QPainter::drawPie ( const QRect ,
int  a,
int  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).

Ver también:
bitBlt(), QPixmap::setMask()

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.

Ver también:
bitBlt(), QPixmap::setMask()
void QPainter::drawPixmap ( const QPoint p,
const QPixmap pm 
)

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.

void QPainter::drawPixmap ( const QPoint p,
const QPixmap pm,
const QRect sr 
) [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 of pixmap pm with its origin at point p.

void QPainter::drawPixmap ( const QRect r,
const QPixmap pm 
)

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::drawPixmap ( const QPoint ,
const QPixmap ,
const QRect sr 
)
void QPainter::drawPixmap ( const QPoint ,
const QPixmap  
)
void QPainter::drawPixmap ( const QRect ,
const QPixmap  
)
void QPainter::drawPoint ( int  x,
int  y 
)

Draws/plots a single point at (x,y) using the current pen.

Ver también:
QPen

Draws/plots a single point at (x, y) using the current pen.

Ver también:
QPen
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 ( int  x,
int  y 
)
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.

Atención:
On X11, coordinates that do not fit into 16-bit signed values are truncated. This limitation is expected to go away in Qt 4.
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.

Ver también:
drawLineSegments(), drawPolyline(), QPen

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.

Atención:
On X11, coordinates that do not fit into 16-bit signed values are truncated. This limitation is expected to go away in Qt 4.
Ver también:
drawLineSegments(), drawPolyline(), QPen
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).

Ver también:
drawLineSegments(), drawPolygon(), QPen

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).

Atención:
On X11, coordinates that do not fit into 16-bit signed values are truncated. This limitation is expected to go away in Qt 4.
Ver también:
drawLineSegments(), drawPolygon(), QPen
void QPainter::drawPolyline ( const QPointArray ,
int  index = 0,
int  npoints = -1 
)
void QPainter::drawRect ( int  x,
int  y,
int  w,
int  h 
)

Draws a rectangle with upper left corner at (x,y) and with width w and height h.

Ver también:
QPen, drawRoundRect()

Draws a rectangle with upper left corner at (x, y) and with width w and height h.

Ver también:
QPen, drawRoundRect()
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 ( int  x,
int  y,
int  w,
int  h 
)
void QPainter::drawRect ( const QRect )
void QPainter::drawRoundRect ( int  x,
int  y,
int  w,
int  h,
int  xRnd = 25,
int  yRnd = 25 
)

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.

Ver también:
drawRect(), QPen

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.

Ver también:
drawRect(), QPen
void QPainter::drawRoundRect ( const QRect r,
int  xRnd = 25,
int  yRnd = 25 
) [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 rounded rectangle r, rounding to the x position xRnd and the y position yRnd on each corner.

void QPainter::drawRoundRect ( const QRect ,
int  = 25,
int  = 25 
)
void QPainter::drawRoundRect ( int  x,
int  y,
int  w,
int  h,
int  = 25,
int  = 25 
)
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.

Ver también:
QPainter::TextDirection
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.

Ver también:
QPainter::TextDirection

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.

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

Ver también:
QPainter::TextDirection
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::drawTextItem ( const QPoint p,
const QTextItem ti,
int  textflags = 0 
)
void QPainter::drawTextItem ( int  x,
int  y,
const QTextItem ti,
int  textflags = 0 
)
void QPainter::drawTextItem ( int  x,
int  y,
const QTextItem ti,
int  textflags = 0 
)
void QPainter::drawTextItem ( const QPoint p,
const QTextItem ti,
int  textflags = 0 
) [inline]
void QPainter::drawTiledPixmap ( int  x,
int  y,
int  w,
int  h,
const QPixmap ,
int  sx = 0,
int  sy = 0 
)
void QPainter::drawTiledPixmap ( const QRect ,
const QPixmap ,
const QPoint  
)
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.

Ver también:
drawPixmap()

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.

Ver también:
drawPixmap()
void QPainter::drawTiledPixmap ( const QRect r,
const QPixmap pm 
) [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 tiled pixmap, pm, inside rectangle r.

void QPainter::drawTiledPixmap ( const QRect r,
const QPixmap pm,
const QPoint sp 
) [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 tiled pixmap, pm, inside rectangle r with its origin at point sp.

void QPainter::drawTiledPixmap ( const QRect ,
const QPixmap  
)
void QPainter::drawWinFocusRect ( int  x,
int  y,
int  w,
int  h,
const QColor bgColor 
)

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()).

Atención:
This function draws nothing if the coordinate system has been rotated or sheared.
Ver también:
drawRect(), QApplication::style()

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()).

Atención:
This function draws nothing if the coordinate system has been rotated or sheared.
Ver también:
drawRect(), QApplication::style()
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.

void QPainter::drawWinFocusRect ( const QRect r,
const QColor bgColor 
) [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 using background color bgColor.

void QPainter::drawWinFocusRect ( int  x,
int  y,
int  w,
int  h 
)

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).

Atención:
This function draws nothing if the coordinate system has been rotated or sheared.
Ver también:
drawRect(), QApplication::style()

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).

Atención:
This function draws nothing if the coordinate system has been rotated or sheared.
Ver también:
drawRect(), QApplication::style()
void QPainter::drawWinFocusRect ( const QRect ,
const QColor bgColor 
)
void QPainter::drawWinFocusRect ( int  x,
int  y,
int  w,
int  h,
const QColor bgColor 
)
void QPainter::drawWinFocusRect ( int  x,
int  y,
int  w,
int  h 
)
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.

Ver también:
begin(), isActive()

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.

Ver también:
begin(), isActive()
void QPainter::eraseRect ( const QRect )
void QPainter::eraseRect ( int  x,
int  y,
int  w,
int  h 
)
void QPainter::eraseRect ( int  x,
int  y,
int  w,
int  h 
) [inline]

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.

void QPainter::fillRect ( int  x,
int  y,
int  w,
int  h,
const QBrush  
)
void QPainter::fillRect ( int  x,
int  y,
int  w,
int  h,
const QBrush brush 
)

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.

Ver también:
drawRect()
void QPainter::fillRect ( const QRect ,
const QBrush  
)
void QPainter::fillRect ( const QRect r,
const QBrush brush 
) [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.

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.

Ver también:
flush() CoordinateMode
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]

Returns the currently set painter font.

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

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

Ver también:
fontInfo(), isActive()
bool QPainter::hasClipping ( ) const [inline]

Returns TRUE if clipping has been set; otherwise returns FALSE.

Ver también:
setClipping()
bool QPainter::hasClipping ( ) const
bool QPainter::hasViewXForm ( ) const [inline]

Returns TRUE if view transformation is enabled; otherwise returns FALSE.

Ver también:
setViewXForm(), xForm()
bool QPainter::hasViewXForm ( ) const
bool QPainter::hasWorldXForm ( ) const [inline]

Returns TRUE if world transformation is enabled; otherwise returns FALSE.

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

Ver también:
QPaintDevice::paintingActive()
void QPainter::lineTo ( int  x,
int  y 
)

Draws a line from the current pen position to (x,y) and sets (x,y) to be the new current pen position.

Ver también:
QPen moveTo(), drawLine(), pos()

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.

Ver también:
QPen moveTo(), drawLine(), pos()
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::lineTo ( int  x,
int  y 
)
void QPainter::moveTo ( int  x,
int  y 
)

Sets the current pen position to (x,y)

Ver también:
lineTo(), pos()

Sets the current pen position to (x, y)

Ver también:
lineTo(), pos()
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 ( int  x,
int  y 
)
void QPainter::moveTo ( const QPoint )
const QPen& QPainter::pen ( ) const
const QPen & QPainter::pen ( ) const [inline]

Returns the painter's current pen.

Ver también:
setPen()
QPoint QPainter::pos ( ) const
QPoint QPainter::pos ( ) const

Returns the current position of the pen.

Ver también:
moveTo()

Returns the current position of the pen.

Ver también:
moveTo()
Qt::RasterOp QPainter::rasterOp ( ) const [inline]

Returns the current raster operation .

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

Ver también:
worldMatrix(), viewport(), window()
void QPainter::restore ( )

Restores the current painter state (pops a saved state off the stack).

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

Ver también:
translate(), scale(), shear(), resetXForm(), setWorldMatrix(), xForm()
void QPainter::save ( const QString id = QString::null)

Saves the current painter state (pushes the state onto a stack). A save() must be followed by a corresponding restore(). end() unwinds the stack.

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

Ver también:
translate(), shear(), rotate(), resetXForm(), setWorldMatrix(), xForm()
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).

Ver también:
backgroundColor() setBackgroundMode() BackgroundMode
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().

Ver también:
backgroundMode(), setBackgroundColor()

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().

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

Ver también:
brush()
void QPainter::setBrush ( const QColor color)

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 have style SolidPattern and the specified color.

Ver también:
brush(), QBrush
void QPainter::setBrush ( BrushStyle  style)

Sets the painter's brush to black color and the specified style.

Ver también:
brush(), QBrush
void QPainter::setBrushOrigin ( int  x,
int  y 
)

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.

Ver también:
brushOrigin()

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.

Ver también:
brushOrigin()
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 ( int  x,
int  y 
)
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.

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

Ver también:
setClipRegion(), clipRegion(), setClipping() QPainter::CoordinateMode
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.

Ver también:
CoordinateMode
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.

Ver también:
setClipRect(), clipRegion(), setClipping()

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.

Ver también:
setClipRect(), clipRegion(), setClipping() CoordinateMode
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.

Ver también:
font(), drawText()

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.

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

Ver también:
pen()
void QPainter::setPen ( const QColor color)

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 pen to have style SolidLine, width 0 and the specified color.

Ver también:
pen(), QPen
void QPainter::setPen ( const QColor )
void QPainter::setPen ( PenStyle  )
void QPainter::setPen ( const QPen )
void QPainter::setPen ( PenStyle  style)

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 pen to have style style, width 0 and black color.

Ver también:
pen(), QPen
void QPainter::setRasterOp ( RasterOp  r)

Sets the raster operation to r. The default is CopyROP.

Ver también:
rasterOp()

Sets the raster operation to r. The default is CopyROP.

Ver también:
rasterOp() Qt::RasterOp
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.

Ver también:
tabArray(), setTabStops(), drawText(), fontMetrics()
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.

Ver también:
tabStops(), setTabArray(), drawText(), fontMetrics()
void QPainter::setTabStops ( int  )
void QPainter::setViewport ( int  x,
int  y,
int  w,
int  h 
)
void QPainter::setViewport ( int  x,
int  y,
int  w,
int  h 
)

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.

Ver también:
viewport(), setWindow(), setViewXForm(), setWorldMatrix(), setWorldXForm(), xForm()
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.

Ver también:
hasViewXForm(), setWindow(), setViewport(), setWorldMatrix(), setWorldXForm(), xForm()
void QPainter::setViewXForm ( bool  )
void QPainter::setWindow ( const QRect )
void QPainter::setWindow ( int  x,
int  y,
int  w,
int  h 
)

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.

Ver también:
window(), setViewport(), setViewXForm(), setWorldMatrix(), setWorldXForm()
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.

void QPainter::setWindow ( int  x,
int  y,
int  w,
int  h 
)
void QPainter::setWorldMatrix ( const QWMatrix m,
bool  combine = FALSE 
)

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.

Ver también:
worldMatrix() setWorldXForm() setWindow() setViewport() setViewXForm() xForm() QWMatrix
void QPainter::setWorldMatrix ( const QWMatrix ,
bool  combine = FALSE 
)
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.

Ver también:
setWorldMatrix(), setWindow(), setViewport(), setViewXForm(), xForm()
void QPainter::shear ( double  sh,
double  sv 
)
void QPainter::shear ( double  sh,
double  sv 
)

Shears the coordinate system by (sh, sv).

Ver también:
translate(), scale(), rotate(), resetXForm(), setWorldMatrix(), xForm()
int * QPainter::tabArray ( ) const [inline]

Returns the currently set tab stop array.

Ver también:
setTabArray()
int* QPainter::tabArray ( ) const
int QPainter::tabStops ( ) const [inline]

Returns the tab stop setting.

Ver también:
setTabStops()
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 );
  }
Ver también:
scale(), shear(), rotate(), resetXForm(), setWorldMatrix(), xForm()
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.

Ver también:
setViewport(), setViewXForm()
QRect QPainter::window ( ) const
QRect QPainter::window ( ) const

Returns the window rectangle.

Ver también:
setWindow(), setViewXForm()
const QWMatrix& QPainter::worldMatrix ( ) const
const QWMatrix & QPainter::worldMatrix ( ) const

Returns the world transformation matrix.

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

Ver también:
xFormDev(), QWMatrix::map()
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
Ver también:
xFormDev(), QWMatrix::map()
QRect QPainter::xForm ( const QRect rv) 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 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.

Ver también:
xFormDev(), QWMatrix::map()
QPoint QPainter::xForm ( const QPoint ) const
QPoint QPainter::xForm ( const QPoint pv) const

Returns the point pv transformed from model coordinates to device coordinates.

Ver también:
xFormDev(), QWMatrix::map()
QPointArray QPainter::xForm ( const QPointArray ) const
QPointArray QPainter::xForm ( const QPointArray ,
int  index,
int  npoints 
) const
QRect QPainter::xForm ( const QRect ) 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
Ver también:
xForm(), QWMatrix::map()
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.

Ver también:
xForm(), QWMatrix::map()
QPointArray QPainter::xFormDev ( const QPointArray ,
int  index,
int  npoints 
) const
QRect QPainter::xFormDev ( const QRect rd) 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.

Ver también:
xForm(), QWMatrix::map()
QRect QPainter::xFormDev ( const QRect ) const
QPoint QPainter::xFormDev ( const QPoint ) const
QPoint QPainter::xFormDev ( const QPoint pd) 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 pd transformed from device coordinates to model coordinates.

Ver también:
xForm(), QWMatrix::map()

Documentación de las funciones relacionadas y clases amigas

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 )}.

Atención:
This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style.
Ver también:
qDrawShadeRect(), QStyle::drawPrimitive()
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 )}.

Atención:
This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style.
Ver también:
qDrawShadeRect(), qDrawShadePanel(), QStyle::drawPrimitive()
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 )}.

Atención:
This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style.
Ver también:
qDrawWinPanel(), qDrawShadeLine(), qDrawShadeRect(), QStyle::drawPrimitive()
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 )}.

Atención:
This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style.
Ver también:
qDrawShadeLine(), qDrawShadePanel(), qDrawPlainRect(), QStyle::drawItem(), QStyle::drawControl() QStyle::drawComplexControl()
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.

Atención:
This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style.
Ver también:
qDrawWinPanel(), QStyle::drawControl()
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 )}.

Atención:
This function does not look at QWidget::style() or QApplication::style(). Use the drawing functions in QStyle to make widgets that follow the current GUI style.
Ver también:
qDrawShadePanel(), qDrawWinButton(), QStyle::drawPrimitive()
QFontInfo [friend]
QFontMetrics [friend]
QPrinter [friend]
void qt_draw_background ( QPainter p,
int  x,
int  y,
int  w,
int  h 
) [friend]
void qt_draw_background ( QPainter p,
int  x,
int  y,
int  w,
int  h 
) [friend]
void qt_draw_transformed_rect ( QPainter p,
int  x,
int  y,
int  w,
int  h,
bool  fill 
) [friend]
void qt_draw_transformed_rect ( QPainter p,
int  x,
int  y,
int  w,
int  h,
bool  fill 
) [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]

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