Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QStylePainter

    java.lang.Object
      com.trolltech.qt.internal.QSignalEmitterInternal
          com.trolltech.qt.QSignalEmitter
              com.trolltech.qt.QtJambiObject
                  com.trolltech.qt.gui.QPainter
                      com.trolltech.qt.gui.QStylePainter

All Implemented Interfaces:
  QtJambiInterface

    public class QStylePainter

extends QPainter

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:

        protected void paintEvent(QPaintEvent event)

        {

            QPainter painter = new QPainter(this);

            QStyleOptionFocusRect option = new QStyleOptionFocusRect();
            option.initFrom(this);
            option.setBackgroundColor(palette().color(QPalette.ColorRole.Window));

            style().drawPrimitive(QStyle.PrimitiveElement.PE_FrameFocusRect,
                                  option, painter, this);

        }

Example using QStylePainter:

        protected void paintEvent(QPaintEvent event)

        {

            QStylePainter painter = new QStylePainter(this);

            QStyleOptionFocusRect option = new QStyleOptionFocusRect();
            option.initFrom(this);
            option.setBackgroundColor(palette().color(QPalette.ColorRole.Window));

            painter.drawPrimitive(QStyle.PrimitiveElement.PE_FrameFocusRect, option);

        }

See also:
  `QStyle`, and `QStyleOption`.

Nested Class Summary

Nested classes/interfaces inherited from class com.trolltech.qt.gui.QPainter
`QPainter.CompositionMode, QPainter.RenderHint, QPainter.RenderHints`

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal`

Field Summary

Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`currentSender`

Constructor Summary
`QStylePainter()` Constructs a QStylePainter.
`QStylePainter(QPaintDeviceInterface pd, QWidget w)` Construct a QStylePainter using `pd` for its paint device, and attributes from `widget`.
`QStylePainter(QWidget w)` Construct a QStylePainter using widget `widget` for its paint device.

Method Summary
`boolean` | `begin(QPaintDeviceInterface pd, QWidget w)` Begin painting operations on paint device `pd` as if it was `widget`.
`boolean` | `begin(QWidget w)` Begin painting operations on the specified `widget`.
`void` | `drawComplexControl(QStyle.ComplexControl cc, QStyleOptionComplex opt)` Use the widget's style to draw a complex control `cc` specified by the `QStyleOptionComplex` `option`.
`void` | `drawControl(QStyle.ControlElement ce, QStyleOption opt)` Use the widget's style to draw a control element `ce` specified by `QStyleOption` `option`.
`void` | `drawItemPixmap(QRect r, int flags, QPixmap pixmap)` Draws the `pixmap` in rectangle `rect`.
`void` | `drawItemText(QRect r, int flags, QPalette pal, boolean enabled, java.lang.String text)` Draws the `text` in rectangle `rect` and palette `pal`.
`void` | `drawItemText(QRect r, int flags, QPalette pal, boolean enabled, java.lang.String text, QPalette.ColorRole textRole)` Draws the `text` in rectangle `rect` and palette `pal`.
`void` | `drawPrimitive(QStyle.PrimitiveElement pe, QStyleOption opt)` Use the widget's style to draw a primitive element `pe` specified by `QStyleOption` `option`.
`QStyle` | `style()` Return the current style used by the QStylePainter.

Methods inherited from class com.trolltech.qt.gui.QPainter
`background, backgroundMode, begin, boundingRect, boundingRect, boundingRect, boundingRect, boundingRect, brush, brushOrigin, clipPath, clipRegion, combinedMatrix, combinedTransform, compositionMode, device, deviceMatrix, deviceTransform, drawArc, drawArc, drawArc, drawChord, drawChord, drawChord, drawConvexPolygon, drawConvexPolygon, drawEllipse, drawEllipse, drawEllipse, drawEllipse, drawEllipse, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawLine, drawLine, drawLine, drawLine, drawLine, drawLines, drawLinesF, drawLinesFromPoints, drawLinesFromPointsF, drawPath, drawPicture, drawPicture, drawPicture, drawPie, drawPie, drawPie, drawPixmap, drawPixmap, drawPixmap, drawPixmap, drawPixmap, drawPixmap, drawPixmap, drawPixmap, drawPixmap, drawPixmap, drawPixmap, drawPoint, drawPoint, drawPoint, drawPoints, drawPoints, drawPolygon, drawPolygon, drawPolygon, drawPolygon, drawPolyline, drawPolyline, drawRect, drawRect, drawRect, drawRects, drawRectsF, drawRoundedRect, drawRoundedRect, drawRoundedRect, drawRoundedRect, drawRoundedRect, drawRoundedRect, drawRoundRect, drawRoundRect, drawRoundRect, drawRoundRect, drawRoundRect, drawRoundRect, drawRoundRect, drawRoundRect, drawRoundRect, drawText, drawText, drawText, drawText, drawText, drawText, drawText, drawText, drawText, drawText, drawText, drawTextItem, drawTiledPixmap, drawTiledPixmap, drawTiledPixmap, drawTiledPixmap, drawTiledPixmap, drawTiledPixmap, drawTiledPixmap, end, eraseRect, eraseRect, eraseRect, fillPath, fillRect, fillRect, fillRect, font, fontInfo, fontMetrics, hasClipping, initFrom, isActive, layoutDirection, opacity, paintEngine, pen, redirected, renderHints, resetMatrix, resetTransform, restore, restoreRedirected, rotate, save, scale, setBackground, setBackgroundMode, setBrush, setBrush, setBrush, setBrush, setBrush, setBrushOrigin, setBrushOrigin, setBrushOrigin, setClipPath, setClipPath, setClipping, setClipRect, setClipRect, setClipRect, setClipRect, setClipRect, setClipRect, setClipRegion, setClipRegion, setCompositionMode, setFont, setLayoutDirection, setOpacity, setPen, setPen, setPen, setRedirected, setRedirected, setRenderHint, setRenderHint, setRenderHints, setRenderHints, setTransform, setTransform, setViewport, setViewport, setViewTransformEnabled, setWindow, setWindow, setWorldMatrix, setWorldMatrix, setWorldMatrixEnabled, setWorldTransform, setWorldTransform, shear, strokePath, testRenderHint, transform, translate, translate, translate, viewport, viewTransformEnabled, window, worldMatrix, worldMatrixEnabled, worldTransform`

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread`

Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`__qt_signalInitialization`

Methods inherited from class java.lang.Object
`clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Constructor Detail

### QStylePainter

    public QStylePainter()

  Constructs a QStylePainter.

### QStylePainter

    public QStylePainter(QPaintDeviceInterface pd,
                         QWidget w)

  Construct a QStylePainter using `pd` for its paint device, and attributes from `widget`.

### QStylePainter

    public QStylePainter(QWidget w)

  Construct a QStylePainter using widget `widget` for its paint device.

Method Detail

### begin

    public final boolean begin(QPaintDeviceInterface pd,
                               QWidget w)

  Begin painting operations on paint device `pd` as if it was `widget`.

  This is automatically called by the constructor that takes a `QPaintDevice` and a `QWidget`.

### begin

    public final boolean begin(QWidget w)

  Begin painting operations on the specified `widget`. Returns true if the painter is ready to use; otherwise returns false.

  This is automatically called by the constructor that takes a `QWidget`.

  Overrides:
    `begin` in class `QPainter`

### drawComplexControl

    public final void drawComplexControl(QStyle.ComplexControl cc,
                                         QStyleOptionComplex opt)

  Use the widget's style to draw a complex control `cc` specified by the `QStyleOptionComplex` `option`.

See also:
  `QStyle::drawComplexControl()`.

### drawControl

    public final void drawControl(QStyle.ControlElement ce,
                                  QStyleOption opt)

  Use the widget's style to draw a control element `ce` specified by `QStyleOption` `option`.

See also:
  `QStyle::drawControl()`.

### drawItemPixmap

    public final void drawItemPixmap(QRect r,
                                     int flags,
                                     QPixmap pixmap)

  Draws the `pixmap` in rectangle `rect`. The pixmap is aligned according to `flags`.

See also:
  `QStyle::drawItemPixmap()`, and Qt::Alignment.

### drawItemText

    public final void drawItemText(QRect r,
                                   int flags,
                                   QPalette pal,
                                   boolean enabled,
                                   java.lang.String text)

  Draws the `text` in rectangle `rect` and palette `pal`. The text is aligned and wrapped according to `flags`.

  The pen color is specified with `textRole`. The `enabled` bool indicates whether or not the item is enabled; when reimplementing this bool should influence how the item is drawn.

See also:
  `QStyle::drawItemText()`, and Qt::Alignment.

### drawItemText

    public final void drawItemText(QRect r,
                                   int flags,
                                   QPalette pal,
                                   boolean enabled,
                                   java.lang.String text,
                                   QPalette.ColorRole textRole)

  Draws the `text` in rectangle `rect` and palette `pal`. The text is aligned and wrapped according to `flags`.

  The pen color is specified with `textRole`. The `enabled` bool indicates whether or not the item is enabled; when reimplementing this bool should influence how the item is drawn.

See also:
  `QStyle::drawItemText()`, and Qt::Alignment.

### drawPrimitive

    public final void drawPrimitive(QStyle.PrimitiveElement pe,
                                    QStyleOption opt)

  Use the widget's style to draw a primitive element `pe` specified by `QStyleOption` `option`.

See also:
  `QStyle::drawPrimitive()`.

### style

    public final QStyle style()

  Return the current style used by the QStylePainter.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD