com.trolltech.qt.gui
Class QGraphicsSimpleTextItem

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.gui.QAbstractGraphicsShapeItem
              extended by com.trolltech.qt.gui.QGraphicsSimpleTextItem
All Implemented Interfaces:
QGraphicsItemInterface, QtJambiInterface

public class QGraphicsSimpleTextItem
extends QAbstractGraphicsShapeItem

The QGraphicsSimpleTextItem class provides a simple text path item that you can add to a QGraphicsScene.

To set the item's text, you can either pass a QString to QGraphicsSimpleTextItem's constructor, or call setText to change the text later. To set the text fill color, call setBrush.

The simple text item can have both a fill and an outline; setBrush will set the text fill (i.e., text color), and setPen sets the pen that will be used to draw the text outline. (The latter can be slow, especially for complex pens, and items with long text content.) If all you want is to draw a simple line of text, you should call setBrush only, and leave the pen unset; QGraphicsSimpleTextItem's pen is by default Qt::NoPen.

QGraphicsSimpleTextItem uses the text's formatted size and the associated font to provide a reasonable implementation of boundingRect, shape, and contains. You can set the font by calling setFont.

QGraphicsSimpleText does not display rich text; instead, you can use QGraphicsTextItem, which provides full text control capabilities.

See Also:
QGraphicsTextItem, QGraphicsPathItem, QGraphicsRectItem, QGraphicsEllipseItem, QGraphicsPixmapItem, QGraphicsPolygonItem, QGraphicsLineItem, The Graphics View Framework

Nested Class Summary
static class QGraphicsSimpleTextItem.enum_1
          Press link for info on QGraphicsSimpleTextItem.enum_1
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Constructor Summary
QGraphicsSimpleTextItem()
          Equivalent to QGraphicsSimpleTextItem(, 0).
QGraphicsSimpleTextItem(QGraphicsItemInterface parent)
          Equivalent to QGraphicsSimpleTextItem(parent, 0).
QGraphicsSimpleTextItem(QGraphicsItemInterface parent, QGraphicsScene scene)
          Constructs a QGraphicsSimpleTextItem, using parent as the default plain text.
QGraphicsSimpleTextItem(java.lang.String text)
          Creates a new parentless QGraphicsSimpleTextItem with the specified text.
QGraphicsSimpleTextItem(java.lang.String text, QGraphicsItemInterface parent)
          Creates a new QGraphicsSimpleTextItem with the specified text and parent.
QGraphicsSimpleTextItem(java.lang.String text, QGraphicsItemInterface parent, QGraphicsScene scene)
          Creates a new QGraphicsSimpleTextItem with the specified text and parent, and adds it to scene.
 
Method Summary
 QRectF boundingRect()
          This function is reimplemented for internal reasons.
 boolean contains(QPointF point)
          This function is reimplemented for internal reasons.
 java.lang.Object extension(java.lang.Object variant)
          This function is reimplemented for internal reasons.
 QFont font()
          Returns the font that is used to draw the item's text.
static QGraphicsSimpleTextItem fromNativePointer(QNativePointer nativePointer)
          This function returns the QGraphicsSimpleTextItem instance pointed to by nativePointer
 boolean isObscuredBy(QGraphicsItemInterface item)
          This function is reimplemented for internal reasons.
 QPainterPath opaqueArea()
          This function is reimplemented for internal reasons.
 void paint(QPainter painter, QStyleOptionGraphicsItem option, QWidget widget)
          This function is reimplemented for internal reasons.
 void setExtension(QGraphicsItem.Extension extension, java.lang.Object variant)
          This method is used internally by Qt Jambi.
 void setFont(QFont font)
          Sets the font that is used to draw the item's text to font.
 void setText(java.lang.String text)
          Sets the item's text to text.
 QPainterPath shape()
          This function is reimplemented for internal reasons.
 boolean supportsExtension(QGraphicsItem.Extension extension)
          This method is used internally by Qt Jambi.
 java.lang.String text()
          Returns the item's text.
 int type()
          This function is reimplemented for internal reasons.
 
Methods inherited from class com.trolltech.qt.gui.QAbstractGraphicsShapeItem
acceptDrops, acceptedMouseButtons, acceptsHoverEvents, addToIndex, advance, brush, childItems, childrenBoundingRect, clearFocus, collidesWithItem, collidesWithPath, collidingItems, contextMenuEvent, cursor, data, deviceTransform, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, ensureVisible, ensureVisible, flags, focusInEvent, focusOutEvent, group, handlesChildEvents, hasCursor, hasFocus, hide, hoverEnterEvent, hoverLeaveEvent, hoverMoveEvent, inputMethodEvent, inputMethodQuery, installSceneEventFilter, isAncestorOf, isEnabled, isObscured, isObscured, isObscured, isSelected, isVisible, itemChange, keyPressEvent, keyReleaseEvent, mapFromItem, mapFromItem, mapFromItem, mapFromItem, mapFromItem, mapFromItem, mapFromParent, mapFromParent, mapFromParent, mapFromParent, mapFromParent, mapFromParent, mapFromScene, mapFromScene, mapFromScene, mapFromScene, mapFromScene, mapFromScene, mapToItem, mapToItem, mapToItem, mapToItem, mapToItem, mapToItem, mapToParent, mapToParent, mapToParent, mapToParent, mapToParent, mapToParent, mapToScene, mapToScene, mapToScene, mapToScene, mapToScene, mapToScene, mouseDoubleClickEvent, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, moveBy, parentItem, pen, pos, prepareGeometryChange, removeFromIndex, removeSceneEventFilter, resetTransform, rotate, scale, scene, sceneBoundingRect, sceneEvent, sceneEventFilter, scenePos, sceneTransform, setAcceptDrops, setAcceptedMouseButtons, setAcceptsHoverEvents, setBrush, setCursor, setData, setEnabled, setFlag, setFlags, setFocus, setGroup, setHandlesChildEvents, setParentItem, setPen, setPos, setPos, setSelected, setToolTip, setTransform, setVisible, setZValue, shear, show, toolTip, topLevelItem, transform, translate, unsetCursor, update, update, wheelEvent, x, y, zValue
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QGraphicsSimpleTextItem

public QGraphicsSimpleTextItem(java.lang.String text,
                               QGraphicsItemInterface parent)
Creates a new QGraphicsSimpleTextItem with the specified text and parent.


QGraphicsSimpleTextItem

public QGraphicsSimpleTextItem(java.lang.String text)
Creates a new parentless QGraphicsSimpleTextItem with the specified text.


QGraphicsSimpleTextItem

public QGraphicsSimpleTextItem(java.lang.String text,
                               QGraphicsItemInterface parent,
                               QGraphicsScene scene)
Creates a new QGraphicsSimpleTextItem with the specified text and parent, and adds it to scene.


QGraphicsSimpleTextItem

public QGraphicsSimpleTextItem(QGraphicsItemInterface parent)

Equivalent to QGraphicsSimpleTextItem(parent, 0).


QGraphicsSimpleTextItem

public QGraphicsSimpleTextItem()

Equivalent to QGraphicsSimpleTextItem(, 0).


QGraphicsSimpleTextItem

public QGraphicsSimpleTextItem(QGraphicsItemInterface parent,
                               QGraphicsScene scene)

Constructs a QGraphicsSimpleTextItem, using parent as the default plain text.

scene is passed to QGraphicsItem's constructor.

See Also:
QGraphicsScene::addItem
Method Detail

font

public final QFont font()

Returns the font that is used to draw the item's text.

See Also:
setFont

setFont

public final void setFont(QFont font)

Sets the font that is used to draw the item's text to font.

See Also:
font

setText

public final void setText(java.lang.String text)

Sets the item's text to text. The text will be displayed as plain text. Newline characters ('\n') as well as characters of type QChar::LineSeparator will cause item to break the text into multiple lines.

See Also:
text

text

public final java.lang.String text()

Returns the item's text.

See Also:
setText

boundingRect

public QRectF boundingRect()

This function is reimplemented for internal reasons.

Specified by:
boundingRect in interface QGraphicsItemInterface
Specified by:
boundingRect in class QAbstractGraphicsShapeItem
See Also:
shape, contains, The Graphics View Coordinate System, prepareGeometryChange

contains

public boolean contains(QPointF point)

This function is reimplemented for internal reasons.

Specified by:
contains in interface QGraphicsItemInterface
Overrides:
contains in class QAbstractGraphicsShapeItem
See Also:
shape, boundingRect, collidesWithPath

extension

public java.lang.Object extension(java.lang.Object variant)

This function is reimplemented for internal reasons.

Specified by:
extension in interface QGraphicsItemInterface
Overrides:
extension in class QAbstractGraphicsShapeItem
See Also:
setExtension

isObscuredBy

public boolean isObscuredBy(QGraphicsItemInterface item)

This function is reimplemented for internal reasons.

Specified by:
isObscuredBy in interface QGraphicsItemInterface
Overrides:
isObscuredBy in class QAbstractGraphicsShapeItem
See Also:
opaqueArea, isObscured

opaqueArea

public QPainterPath opaqueArea()

This function is reimplemented for internal reasons.

Specified by:
opaqueArea in interface QGraphicsItemInterface
Overrides:
opaqueArea in class QAbstractGraphicsShapeItem
See Also:
isObscuredBy, isObscured, shape

paint

public void paint(QPainter painter,
                  QStyleOptionGraphicsItem option,
                  QWidget widget)

This function is reimplemented for internal reasons.

Specified by:
paint in interface QGraphicsItemInterface
Specified by:
paint in class QAbstractGraphicsShapeItem

setExtension

public void setExtension(QGraphicsItem.Extension extension,
                         java.lang.Object variant)

This method is used internally by Qt Jambi. Do not use it in your applications.

Specified by:
setExtension in interface QGraphicsItemInterface
Overrides:
setExtension in class QAbstractGraphicsShapeItem
See Also:
extension

shape

public QPainterPath shape()

This function is reimplemented for internal reasons.

Specified by:
shape in interface QGraphicsItemInterface
Overrides:
shape in class QAbstractGraphicsShapeItem
See Also:
boundingRect, contains, prepareGeometryChange

supportsExtension

public boolean supportsExtension(QGraphicsItem.Extension extension)

This method is used internally by Qt Jambi. Do not use it in your applications.

Specified by:
supportsExtension in interface QGraphicsItemInterface
Overrides:
supportsExtension in class QAbstractGraphicsShapeItem

type

public int type()

This function is reimplemented for internal reasons.

Specified by:
type in interface QGraphicsItemInterface
Overrides:
type in class QAbstractGraphicsShapeItem

fromNativePointer

public static QGraphicsSimpleTextItem fromNativePointer(QNativePointer nativePointer)
This function returns the QGraphicsSimpleTextItem instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.