com.trolltech.qt.gui
Class QGraphicsSimpleTextItem

java.lang.Object
  extended by com.trolltech.qt.internal.QSignalEmitterInternal
      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, and The Graphics View Framework.


Nested Class Summary
static class QGraphicsSimpleTextItem.enum_1
           
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.PrivateSignal0, QSignalEmitter.PrivateSignal1, QSignalEmitter.PrivateSignal2, QSignalEmitter.PrivateSignal3, QSignalEmitter.PrivateSignal4, QSignalEmitter.PrivateSignal5, QSignalEmitter.PrivateSignal6, QSignalEmitter.PrivateSignal7, QSignalEmitter.PrivateSignal8, QSignalEmitter.PrivateSignal9, 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
QGraphicsSimpleTextItem()
          Constructs a QGraphicsSimpleTextItem.
QGraphicsSimpleTextItem(QGraphicsItemInterface parent)
          Constructs a QGraphicsSimpleTextItem.
QGraphicsSimpleTextItem(QGraphicsItemInterface parent, QGraphicsScene scene)
          Constructs a QGraphicsSimpleTextItem.
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
 QFont font()
          Returns the font that is used to draw the item's text.
 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.
 java.lang.String text()
          Returns the item's text.
 
Methods inherited from class com.trolltech.qt.gui.QAbstractGraphicsShapeItem
acceptDrops, acceptedMouseButtons, acceptHoverEvents, acceptsHoverEvents, advance, boundingRect, boundingRegion, boundingRegionGranularity, brush, cacheMode, childItems, childrenBoundingRect, clearFocus, clipPath, collidesWithItem, collidesWithPath, collidingItems, commonAncestorItem, contains, contextMenuEvent, cursor, data, deviceTransform, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, effectiveOpacity, ensureVisible, ensureVisible, flags, focusInEvent, focusOutEvent, grabKeyboard, grabMouse, group, handlesChildEvents, hasCursor, hasFocus, hide, hoverEnterEvent, hoverLeaveEvent, hoverMoveEvent, inputMethodEvent, inputMethodQuery, installSceneEventFilter, isAncestorOf, isClipped, isEnabled, isObscured, isObscured, isObscured, isObscuredBy, isSelected, isUnderMouse, isVisible, isVisibleTo, isWidget, isWindow, itemChange, itemTransform, keyPressEvent, keyReleaseEvent, mapFromItem, mapFromItem, mapFromItem, mapFromItem, mapFromItem, mapFromItem, mapFromParent, mapFromParent, mapFromParent, mapFromParent, mapFromParent, mapFromParent, mapFromScene, mapFromScene, mapFromScene, mapFromScene, mapFromScene, mapFromScene, mapRectFromItem, mapRectFromItem, mapRectFromParent, mapRectFromParent, mapRectFromScene, mapRectFromScene, mapRectToItem, mapRectToItem, mapRectToParent, mapRectToParent, mapRectToScene, mapRectToScene, mapToItem, mapToItem, mapToItem, mapToItem, mapToItem, mapToItem, mapToParent, mapToParent, mapToParent, mapToParent, mapToParent, mapToParent, mapToScene, mapToScene, mapToScene, mapToScene, mapToScene, mapToScene, mouseDoubleClickEvent, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, moveBy, opacity, opaqueArea, paint, parentItem, parentWidget, pen, pos, prepareGeometryChange, removeSceneEventFilter, resetTransform, rotate, scale, scene, sceneBoundingRect, sceneEvent, sceneEventFilter, scenePos, sceneTransform, scroll, setAcceptDrops, setAcceptedMouseButtons, setAcceptHoverEvents, setAcceptsHoverEvents, setBoundingRegionGranularity, setBrush, setCacheMode, setCursor, setData, setEnabled, setFlag, setFlags, setFocus, setGroup, setHandlesChildEvents, setOpacity, setParentItem, setPen, setPos, setPos, setSelected, setToolTip, setTransform, setVisible, setZValue, shape, shear, show, toolTip, topLevelItem, topLevelWidget, transform, translate, type, ungrabKeyboard, ungrabMouse, unsetCursor, update, update, wheelEvent, window, x, y, zValue
 
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

QGraphicsSimpleTextItem

public QGraphicsSimpleTextItem(QGraphicsItemInterface parent)
Constructs a QGraphicsSimpleTextItem.

parent is passed to QGraphicsItem's constructor. The item is added to scene.

See also:
QGraphicsScene::addItem().


QGraphicsSimpleTextItem

public QGraphicsSimpleTextItem()
Constructs a QGraphicsSimpleTextItem.

parent is passed to QGraphicsItem's constructor. The item is added to scene.

See also:
QGraphicsScene::addItem().


QGraphicsSimpleTextItem

public QGraphicsSimpleTextItem(QGraphicsItemInterface parent,
                               QGraphicsScene scene)
Constructs a QGraphicsSimpleTextItem.

parent is passed to QGraphicsItem's constructor. The item is added to scene.

See also:
QGraphicsScene::addItem().


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.

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