|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.gui.QPainter
com.trolltech.qt.gui.QStylePainter
public class QStylePainter
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); }
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.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 |
---|
public QStylePainter()
public QStylePainter(QPaintDeviceInterface pd, QWidget w)
public QStylePainter(QWidget w)
Method Detail |
---|
public final boolean begin(QPaintDeviceInterface pd, QWidget w)
This is automatically called by the constructor that takes a QPaintDevice
and a QWidget
.
public final boolean begin(QWidget w)
This is automatically called by the constructor that takes a QWidget
.
begin
in class QPainter
public final void drawComplexControl(QStyle.ComplexControl cc, QStyleOptionComplex opt)
QStyleOptionComplex
option. QStyle::drawComplexControl()
.
public final void drawControl(QStyle.ControlElement ce, QStyleOption opt)
QStyleOption
option. QStyle::drawControl()
.
public final void drawItemPixmap(QRect r, int flags, QPixmap pixmap)
QStyle::drawItemPixmap()
, and Qt::Alignment.
public final void drawItemText(QRect r, int flags, QPalette pal, boolean enabled, java.lang.String text)
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.
QStyle::drawItemText()
, and Qt::Alignment.
public final void drawItemText(QRect r, int flags, QPalette pal, boolean enabled, java.lang.String text, QPalette.ColorRole textRole)
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.
QStyle::drawItemText()
, and Qt::Alignment.
public final void drawPrimitive(QStyle.PrimitiveElement pe, QStyleOption opt)
QStyleOption
option. QStyle::drawPrimitive()
.
public final QStyle style()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |