Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

QStylePainter Class Reference

Inheritance diagram for QStylePainter:

QPainter

List of all members.


Detailed Description

The QStylePainter class is a convenience class for drawing QStyle elements inside a widget.

QStylePainter extends QPainter with a set of high-level draw...() functions implemented on top of QStyle's API. The advantage of using QStylePainter is that the parameter lists get considerably shorter. Whereas a QStyle object must be able to draw on any widget using any painter (because the application normally has one QStyle object shared by all widget), a QStylePainter is initialized with a widget, eliminating the need to specify the QWidget, the QPainter, and the QStyle for every function call.

Example using QStyle directly:

snippets/styles/styles.cpp paintEvent( }

Example using QStylePainter:

snippets/styles/styles.cpp paintEvent( paintEvent paintEvent2( { }

See also:
QStyle, QStyleOption

Definition at line 55 of file qstylepainter.h.


Public Types

enum  CompositionMode {
  CompositionMode_SourceOver, CompositionMode_DestinationOver, CompositionMode_Clear, CompositionMode_Source,
  CompositionMode_Destination, CompositionMode_SourceIn, CompositionMode_DestinationIn, CompositionMode_SourceOut,
  CompositionMode_DestinationOut, CompositionMode_SourceAtop, CompositionMode_DestinationAtop, CompositionMode_Xor,
  CompositionMode_Plus, CompositionMode_Multiply, CompositionMode_Screen, CompositionMode_Overlay,
  CompositionMode_Darken, CompositionMode_Lighten, CompositionMode_ColorDodge, CompositionMode_ColorBurn,
  CompositionMode_HardLight, CompositionMode_SoftLight, CompositionMode_Difference, CompositionMode_Exclusion
}
enum  RenderHint { Antialiasing = 0x01, TextAntialiasing = 0x02, SmoothPixmapTransform = 0x04, HighQualityAntialiasing = 0x08 }

Public Member Functions

const QBrushbackground () const
Qt::BGMode backgroundMode () const
bool begin (QPaintDevice *)
bool begin (QPaintDevice *pd, QWidget *w)
bool begin (QWidget *w)
QRectF boundingRect (const QRectF &rect, const QString &text, const QTextOption &o=QTextOption())
QRect boundingRect (int x, int y, int w, int h, int flags, const QString &text)
QRect boundingRect (const QRect &rect, int flags, const QString &text)
QRectF boundingRect (const QRectF &rect, int flags, const QString &text)
const QBrushbrush () const
QPoint brushOrigin () const
QPainterPath clipPath () const
QRegion clipRegion () const
QMatrix combinedMatrix () const
QTransform combinedTransform () const
CompositionMode compositionMode () const
QPaintDevicedevice () const
const QMatrixdeviceMatrix () const
const QTransformdeviceTransform () const
void drawArc (int x, int y, int w, int h, int a, int alen)
void drawArc (const QRect &, int a, int alen)
void drawArc (const QRectF &rect, int a, int alen)
void drawChord (const QRect &, int a, int alen)
void drawChord (int x, int y, int w, int h, int a, int alen)
void drawChord (const QRectF &rect, int a, int alen)
void drawComplexControl (QStyle::ComplexControl cc, const QStyleOptionComplex &opt)
void drawControl (QStyle::ControlElement ce, const QStyleOption &opt)
void drawConvexPolygon (const QPolygon &polygon)
void drawConvexPolygon (const QPoint *points, int pointCount)
void drawConvexPolygon (const QPolygonF &polygon)
void drawConvexPolygon (const QPointF *points, int pointCount)
void drawEllipse (int x, int y, int w, int h)
void drawEllipse (const QRect &r)
void drawEllipse (const QRectF &r)
void drawImage (int x, int y, const QImage &image, int sx=0, int sy=0, int sw=-1, int sh=-1, Qt::ImageConversionFlags flags=Qt::AutoColor)
void drawImage (const QPoint &p, const QImage &image)
void drawImage (const QPointF &p, const QImage &image)
void drawImage (const QRect &r, const QImage &image)
void drawImage (const QRectF &r, const QImage &image)
void drawImage (const QPoint &p, const QImage &image, const QRect &sr, Qt::ImageConversionFlags flags=Qt::AutoColor)
void drawImage (const QPointF &p, const QImage &image, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor)
void drawImage (const QRect &targetRect, const QImage &image, const QRect &sourceRect, Qt::ImageConversionFlags flags=Qt::AutoColor)
void drawImage (const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags=Qt::AutoColor)
void drawItemPixmap (const QRect &r, int flags, const QPixmap &pixmap)
void drawItemText (const QRect &r, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole)
void drawLine (const QPointF &p1, const QPointF &p2)
void drawLine (const QPoint &p1, const QPoint &p2)
void drawLine (int x1, int y1, int x2, int y2)
void drawLine (const QLine &line)
void drawLine (const QLineF &line)
void drawLines (const QVector< QPoint > &pointPairs)
void drawLines (const QPoint *pointPairs, int lineCount)
void drawLines (const QVector< QLine > &lines)
void drawLines (const QLine *lines, int lineCount)
void drawLines (const QVector< QPointF > &pointPairs)
void drawLines (const QPointF *pointPairs, int lineCount)
void drawLines (const QVector< QLineF > &lines)
void drawLines (const QLineF *lines, int lineCount)
void drawPath (const QPainterPath &path)
void drawPicture (const QPoint &p, const QPicture &picture)
void drawPicture (int x, int y, const QPicture &picture)
void drawPicture (const QPointF &p, const QPicture &picture)
void drawPie (const QRect &, int a, int alen)
void drawPie (int x, int y, int w, int h, int a, int alen)
void drawPie (const QRectF &rect, int a, int alen)
void drawPixmap (int x, int y, int w, int h, const QPixmap &pm)
void drawPixmap (const QRect &r, const QPixmap &pm)
void drawPixmap (int x, int y, const QPixmap &pm)
void drawPixmap (const QPoint &p, const QPixmap &pm)
void drawPixmap (const QPointF &p, const QPixmap &pm)
void drawPixmap (const QPoint &p, const QPixmap &pm, const QRect &sr)
void drawPixmap (const QPointF &p, const QPixmap &pm, const QRectF &sr)
void drawPixmap (int x, int y, const QPixmap &pm, int sx, int sy, int sw, int sh)
void drawPixmap (int x, int y, int w, int h, const QPixmap &pm, int sx, int sy, int sw, int sh)
void drawPixmap (const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect)
void drawPixmap (const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
void drawPoint (int x, int y)
void drawPoint (const QPoint &p)
void drawPoint (const QPointF &pt)
void drawPoints (const QPolygon &points)
void drawPoints (const QPoint *points, int pointCount)
void drawPoints (const QPolygonF &points)
void drawPoints (const QPointF *points, int pointCount)
void drawPolygon (const QPolygon &polygon, Qt::FillRule fillRule=Qt::OddEvenFill)
void drawPolygon (const QPoint *points, int pointCount, Qt::FillRule fillRule=Qt::OddEvenFill)
void drawPolygon (const QPolygonF &polygon, Qt::FillRule fillRule=Qt::OddEvenFill)
void drawPolygon (const QPointF *points, int pointCount, Qt::FillRule fillRule=Qt::OddEvenFill)
void drawPolyline (const QPolygon &polygon)
void drawPolyline (const QPoint *points, int pointCount)
void drawPolyline (const QPolygonF &polyline)
void drawPolyline (const QPointF *points, int pointCount)
void drawPrimitive (QStyle::PrimitiveElement pe, const QStyleOption &opt)
void drawRect (const QRect &rect)
void drawRect (int x1, int y1, int w, int h)
void drawRect (const QRectF &rect)
void drawRects (const QVector< QRect > &rectangles)
void drawRects (const QRect *rects, int rectCount)
void drawRects (const QVector< QRectF > &rectangles)
void drawRects (const QRectF *rects, int rectCount)
void drawRoundRect (const QRect &r, int xround=25, int yround=25)
void drawRoundRect (int x, int y, int w, int h, int=25, int=25)
void drawRoundRect (const QRectF &r, int xround=25, int yround=25)
void drawText (const QRectF &r, const QString &text, const QTextOption &o=QTextOption())
void drawText (int x, int y, int w, int h, int flags, const QString &text, QRect *br=0)
void drawText (const QRect &r, int flags, const QString &text, QRect *br=0)
void drawText (const QRectF &r, int flags, const QString &text, QRectF *br=0)
void drawText (int x, int y, const QString &s)
void drawText (const QPoint &p, const QString &s)
void drawText (const QPointF &p, const QString &s)
void drawTextItem (const QPoint &p, const QTextItem &ti)
void drawTextItem (int x, int y, const QTextItem &ti)
void drawTextItem (const QPointF &p, const QTextItem &ti)
void drawTiledPixmap (const QRect &, const QPixmap &, const QPoint &=QPoint())
void drawTiledPixmap (int x, int y, int w, int h, const QPixmap &, int sx=0, int sy=0)
void drawTiledPixmap (const QRectF &rect, const QPixmap &pm, const QPointF &offset=QPointF())
bool end ()
void eraseRect (const QRect &)
void eraseRect (int x, int y, int w, int h)
void eraseRect (const QRectF &)
void fillPath (const QPainterPath &path, const QBrush &brush)
void fillRect (const QRect &, const QBrush &)
void fillRect (int x, int y, int w, int h, const QBrush &)
void fillRect (const QRectF &, const QBrush &)
const QFontfont () const
QFontInfo fontInfo () const
QFontMetrics fontMetrics () const
bool hasClipping () const
void initFrom (const QWidget *widget)
bool isActive () const
Qt::LayoutDirection layoutDirection () const
const QMatrixmatrix () const
bool matrixEnabled () const
qreal opacity () const
QPaintEnginepaintEngine () const
const QPenpen () const
 QStylePainter (QPaintDevice *pd, QWidget *w)
 QStylePainter (QWidget *w)
 QStylePainter ()
RenderHints renderHints () const
void resetMatrix ()
void resetTransform ()
void restore ()
void rotate (qreal a)
void save ()
void scale (qreal sx, qreal sy)
void setBackground (const QBrush &bg)
void setBackgroundMode (Qt::BGMode mode)
void setBrush (Qt::BrushStyle style)
void setBrush (const QBrush &brush)
void setBrushOrigin (const QPointF &)
void setBrushOrigin (const QPoint &)
void setBrushOrigin (int x, int y)
void setClipPath (const QPainterPath &path, Qt::ClipOperation op=Qt::ReplaceClip)
void setClipping (bool enable)
void setClipRect (int x, int y, int w, int h, Qt::ClipOperation op=Qt::ReplaceClip)
void setClipRect (const QRect &, Qt::ClipOperation op=Qt::ReplaceClip)
void setClipRect (const QRectF &, Qt::ClipOperation op=Qt::ReplaceClip)
void setClipRegion (const QRegion &, Qt::ClipOperation op=Qt::ReplaceClip)
void setCompositionMode (CompositionMode mode)
void setFont (const QFont &f)
void setLayoutDirection (Qt::LayoutDirection direction)
void setMatrix (const QMatrix &matrix, bool combine=false)
void setMatrixEnabled (bool enabled)
void setOpacity (qreal opacity)
void setPen (Qt::PenStyle style)
void setPen (const QPen &pen)
void setPen (const QColor &color)
void setRenderHint (RenderHint hint, bool on=true)
void setRenderHints (RenderHints hints, bool on=true)
void setTransform (const QTransform &transform, bool combine=false)
void setViewport (int x, int y, int w, int h)
void setViewport (const QRect &viewport)
void setViewTransformEnabled (bool enable)
void setWindow (int x, int y, int w, int h)
void setWindow (const QRect &window)
void setWorldMatrix (const QMatrix &matrix, bool combine=false)
void setWorldMatrixEnabled (bool enabled)
void setWorldTransform (const QTransform &matrix, bool combine=false)
void shear (qreal sh, qreal sv)
void strokePath (const QPainterPath &path, const QPen &pen)
QStylestyle () const
bool testRenderHint (RenderHint hint) const
const QTransformtransform () const
void translate (qreal dx, qreal dy)
void translate (const QPoint &offset)
void translate (const QPointF &offset)
QRect viewport () const
bool viewTransformEnabled () const
QRect window () const
const QMatrixworldMatrix () const
bool worldMatrixEnabled () const
const QTransformworldTransform () const

Static Public Member Functions

static QPaintDeviceredirected (const QPaintDevice *device, QPoint *offset=0)
static void restoreRedirected (const QPaintDevice *device)
static void setRedirected (const QPaintDevice *device, QPaintDevice *replacement, const QPoint &offset=QPoint())

Private Attributes

QWidgetwidget
QStylewstyle

Related Functions

(Note that these are not member functions.)

void qDrawPlainRect (QPainter *painter, const QRect &rect, const QColor &lineColor, int lineWidth, const QBrush *fill)
void qDrawPlainRect (QPainter *painter, int x, int y, int width, int height, const QColor &lineColor, int lineWidth, const QBrush *fill)
void qDrawShadeLine (QPainter *painter, const QPoint &p1, const QPoint &p2, const QPalette &palette, bool sunken, int lineWidth, int midLineWidth)
void qDrawShadeLine (QPainter *painter, int x1, int y1, int x2, int y2, const QPalette &palette, bool sunken, int lineWidth, int midLineWidth)
void qDrawShadePanel (QPainter *painter, const QRect &rect, const QPalette &palette, bool sunken, int lineWidth, const QBrush *fill)
void qDrawShadePanel (QPainter *painter, int x, int y, int width, int height, const QPalette &palette, bool sunken, int lineWidth, const QBrush *fill)
void qDrawShadeRect (QPainter *painter, const QRect &rect, const QPalette &palette, bool sunken, int lineWidth, int midLineWidth, const QBrush *fill)
void qDrawShadeRect (QPainter *painter, int x, int y, int width, int height, const QPalette &palette, bool sunken, int lineWidth, int midLineWidth, const QBrush *fill)
void qDrawWinButton (QPainter *painter, const QRect &rect, const QPalette &palette, bool sunken, const QBrush *fill)
void qDrawWinButton (QPainter *painter, int x, int y, int width, int height, const QPalette &palette, bool sunken, const QBrush *fill)
void qDrawWinPanel (QPainter *painter, int x, int y, int width, int height, const QPalette &palette, bool sunken, const QBrush *fill)

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index