Qt Jambi Home

com.trolltech.qt.gui
Class QGraphicsTextItem

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.core.QObject
              extended by com.trolltech.qt.gui.QGraphicsTextItem
All Implemented Interfaces:
QGraphicsItemInterface, QtJambiInterface

public class QGraphicsTextItem
extends QObject
implements QGraphicsItemInterface

The QGraphicsTextItem class provides a text item that you can add to a QGraphicsScene to display formatted text.

To set the item's text, pass a QString to QGraphicsTextItem's constructor, or call setHtml/setPlainText.

QGraphicsTextItem 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.

It is possible to make the item editable by setting the Qt::TextEditable flag using setTextInteractionFlags.

The item's preferred text width can be set using setTextWidth and obtained using textWidth.

Note: In order to align HTML text in the center, the item's text width must be set.

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

Nested Class Summary
static class QGraphicsTextItem.enum_1
          Press link for info on QGraphicsTextItem.enum_1
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, 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>
 
Field Summary
 QSignalEmitter.Signal1<java.lang.String> linkActivated
          This signal is emitted when the user clicks on a link on a text item that enables Qt::LinksAccessibleByMouse or Qt::LinksAccessibleByKeyboard.
 QSignalEmitter.Signal1<java.lang.String> linkHovered
          This signal is emitted when the user hovers over a link on a text item that enables Qt::LinksAccessibleByMouse.
 
Constructor Summary
QGraphicsTextItem()
          Equivalent to QGraphicsTextItem(, 0).
QGraphicsTextItem(QGraphicsItemInterface parent)
          Equivalent to QGraphicsTextItem(parent, 0).
QGraphicsTextItem(QGraphicsItemInterface parent, QGraphicsScene scene)
          Constructs a QGraphicsTextItem, using parent as the default plain text.
QGraphicsTextItem(java.lang.String text)
          Creates a new QGraphicsTextItem with the specified text.
QGraphicsTextItem(java.lang.String text, QGraphicsItemInterface parent)
          Creates a new QGraphicsTextItem with the specified text and parent graphics item.
QGraphicsTextItem(java.lang.String text, QGraphicsItemInterface parent, QGraphicsScene scene)
          Creates a new QGraphicsTextItem with the specified text, parent, and scene.
 
Method Summary
 boolean acceptDrops()
          Returns true if this item can accept drag and drop events; otherwise, returns false.
 Qt.MouseButtons acceptedMouseButtons()
          Returns the mouse buttons that this item accepts mouse events for.
 boolean acceptsHoverEvents()
          Returns true if an item accepts hover events (QGraphicsSceneHoverEvent); otherwise, returns false.
 void addToIndex()
          
 void adjustSize()
          Adjusts the text item to a reasonable size.
 void advance(int phase)
          This virtual function is called twice for all items by the QGraphicsScene::advance() slot.
 QRectF boundingRect()
          This function is reimplemented for internal reasons.
 java.util.List<QGraphicsItemInterface> childItems()
          Returns a list of child objects.
 QRectF childrenBoundingRect()
          Returns the bounding rect of this item's descendents (i.e., its children, their children, etc.) in local coordinates.
 void clearFocus()
          Takes keyboard input focus from the item.
 boolean collidesWithItem(QGraphicsItemInterface other, Qt.ItemSelectionMode mode)
          Returns true if this item collides with other; otherwise returns false.
 boolean collidesWithPath(QPainterPath path, Qt.ItemSelectionMode mode)
          Returns true if this item collides with path.
 java.util.List<QGraphicsItemInterface> collidingItems(Qt.ItemSelectionMode mode)
          Returns a list of all items that collide with this item.
 boolean contains(QPointF point)
          This function is reimplemented for internal reasons.
 void contextMenuEvent(QGraphicsSceneContextMenuEvent event)
          This function is reimplemented for internal reasons.
 QCursor cursor()
          Returns the current cursor shape for the item.
 java.lang.Object data(int key)
          Returns this item's custom data for the key key as a QVariant.
 QColor defaultTextColor()
          Returns the default text color that is used to for unformatted text.
 QTransform deviceTransform(QTransform viewportTransform)
          Returns this item's device transformation matrix, using viewportTransform to map from scene to device coordinates.
 QTextDocument document()
          Returns the item's text document.
 void dragEnterEvent(QGraphicsSceneDragDropEvent event)
          This function is reimplemented for internal reasons.
 void dragLeaveEvent(QGraphicsSceneDragDropEvent event)
          This function is reimplemented for internal reasons.
 void dragMoveEvent(QGraphicsSceneDragDropEvent event)
          This function is reimplemented for internal reasons.
 void dropEvent(QGraphicsSceneDragDropEvent event)
          This function is reimplemented for internal reasons.
 void ensureVisible(double x, double y, double w, double h, int xmargin, int ymargin)
          This convenience function is equivalent to calling ensureVisible(QRectF(x, y, w, h), xmargin, ymargin):
 void ensureVisible(QRectF rect, int xmargin, int ymargin)
          If this item is part of a scene that is viewed by a QGraphicsView, this convenience function will attempt to scroll the view to ensure that rect is visible inside the view's viewport.
 java.lang.Object extension(java.lang.Object variant)
          This function is reimplemented for internal reasons.
 QGraphicsItem.GraphicsItemFlags flags()
          Returns this item's flags.
 void focusInEvent(QFocusEvent event)
          This function is reimplemented for internal reasons.
 void focusOutEvent(QFocusEvent event)
          This function is reimplemented for internal reasons.
 QFont font()
          Returns the item's font, which is used to render the text.
static QGraphicsTextItem fromNativePointer(QNativePointer nativePointer)
          This function returns the QGraphicsTextItem instance pointed to by nativePointer
 QGraphicsItemGroup group()
          Returns a pointer to this item's item group, or 0 if this item is not member of a group.
 boolean handlesChildEvents()
          Returns true if this item handles child events (i.e., all events intended for any of its children are instead sent to this item); otherwise, false is returned.
 boolean hasCursor()
          Returns true if this item has a cursor set; otherwise, false is returned.
 boolean hasFocus()
          Returns true if this item has focus (i.e., can accept key events); otherwise, returns false.
 void hide()
          Hides the item.
 void hoverEnterEvent(QGraphicsSceneHoverEvent event)
          This function is reimplemented for internal reasons.
 void hoverLeaveEvent(QGraphicsSceneHoverEvent event)
          This function is reimplemented for internal reasons.
 void hoverMoveEvent(QGraphicsSceneHoverEvent event)
          This function is reimplemented for internal reasons.
 void inputMethodEvent(QInputMethodEvent event)
          This function is reimplemented for internal reasons.
 java.lang.Object inputMethodQuery(Qt.InputMethodQuery query)
          This function is reimplemented for internal reasons.
 void installSceneEventFilter(QGraphicsItemInterface filterItem)
          Installs an event filter for this item on filterItem, causing all events for this item to first pass through filterItem's sceneEventFilter function.
 boolean isAncestorOf(QGraphicsItemInterface child)
          Returns true if this item is an ancestor of child (i.e., if this item is child's parent, or one of child's parent's ancestors).
 boolean isEnabled()
          Returns true if the item is enabled; otherwise, false is returned.
 boolean isObscured()
          Returns true if this item's bounding rect is completely obscured by the opaque shape of any of colliding items above it (i.e., with a higher Z value than this item).
 boolean isObscured(double x, double y, double w, double h)
          This convenience function is equivalent to calling isObscured(QRectF(x, y, w, h)).
 boolean isObscured(QRectF rect)
          Returns true if rect is completely obscured by the opaque shape of any of colliding items above it (i.e., with a higher Z value than this item).
 boolean isObscuredBy(QGraphicsItemInterface item)
          This function is reimplemented for internal reasons.
 boolean isSelected()
          Returns true if this item is selected; otherwise, false is returned.
 boolean isVisible()
          Returns true if the item is visible; otherwise, false is returned.
 java.lang.Object itemChange(QGraphicsItem.GraphicsItemChange change, java.lang.Object value)
          This virtual function is called by QGraphicsItem to notify custom items that some part of the item's state changes.
 void keyPressEvent(QKeyEvent event)
          This function is reimplemented for internal reasons.
 void keyReleaseEvent(QKeyEvent event)
          This function is reimplemented for internal reasons.
 QPointF mapFromItem(QGraphicsItemInterface item, double x, double y)
          This convenience function is equivalent to calling mapFromItem(item, QPointF(x, y)).
 QPolygonF mapFromItem(QGraphicsItemInterface item, double x, double y, double w, double h)
          This convenience function is equivalent to calling mapFromItem(item, QRectF(x, y, w, h)).
 QPainterPath mapFromItem(QGraphicsItemInterface item, QPainterPath path)
          Maps the path path, which is in item's coordinate system, to this item's coordinate system, and returns the mapped path.
 QPointF mapFromItem(QGraphicsItemInterface item, QPointF point)
          Maps the point point, which is in item's coordinate system, to this item's coordinate system, and returns the mapped coordinate.
 QPolygonF mapFromItem(QGraphicsItemInterface item, QPolygonF polygon)
          Maps the polygon polygon, which is in item's coordinate system, to this item's coordinate system, and returns the mapped polygon.
 QPolygonF mapFromItem(QGraphicsItemInterface item, QRectF rect)
          Maps the rectangle rect, which is in item's coordinate system, to this item's coordinate system, and returns the mapped rectangle as a polygon.
 QPointF mapFromParent(double x, double y)
          This convenience function is equivalent to calling mapFromParent(QPointF(x, y)).
 QPolygonF mapFromParent(double x, double y, double w, double h)
          This convenience function is equivalent to calling mapFromItem(QRectF(x, y, w, h)).
 QPainterPath mapFromParent(QPainterPath path)
          Maps the path path, which is in this item's parent's coordinate system, to this item's coordinate system, and returns the mapped path.
 QPointF mapFromParent(QPointF point)
          Maps the point point, which is in this item's parent's coordinate system, to this item's coordinate system, and returns the mapped coordinate.
 QPolygonF mapFromParent(QPolygonF polygon)
          Maps the polygon polygon, which is in this item's parent's coordinate system, to this item's coordinate system, and returns the mapped polygon.
 QPolygonF mapFromParent(QRectF rect)
          Maps the rectangle rect, which is in this item's parent's coordinate system, to this item's coordinate system, and returns the mapped rectangle as a polygon.
 QPointF mapFromScene(double x, double y)
          This convenience function is equivalent to calling mapFromScene(QPointF(x, y)).
 QPolygonF mapFromScene(double x, double y, double w, double h)
          This convenience function is equivalent to calling mapFromScene(QRectF(x, y, w, h)).
 QPainterPath mapFromScene(QPainterPath path)
          Maps the path path, which is in this item's scene's coordinate system, to this item's coordinate system, and returns the mapped path.
 QPointF mapFromScene(QPointF point)
          Maps the point point, which is in this item's scene's coordinate system, to this item's coordinate system, and returns the mapped coordinate.
 QPolygonF mapFromScene(QPolygonF polygon)
          Maps the polygon polygon, which is in this item's scene's coordinate system, to this item's coordinate system, and returns the mapped polygon.
 QPolygonF mapFromScene(QRectF rect)
          Maps the rectangle rect, which is in this item's scene's coordinate system, to this item's coordinate system, and returns the mapped rectangle as a polygon.
 QPointF mapToItem(QGraphicsItemInterface item, double x, double y)
          This convenience function is equivalent to calling mapToItem(item, QPointF(x, y)).
 QPolygonF mapToItem(QGraphicsItemInterface item, double x, double y, double w, double h)
          This convenience function is equivalent to calling mapToItem(item, QRectF(x, y, w, h)).
 QPainterPath mapToItem(QGraphicsItemInterface item, QPainterPath path)
          Maps the path path, which is in this item's coordinate system, to item's coordinate system, and returns the mapped path.
 QPointF mapToItem(QGraphicsItemInterface item, QPointF point)
          Maps the point point, which is in this item's coordinate system, to item's coordinate system, and returns the mapped coordinate.
 QPolygonF mapToItem(QGraphicsItemInterface item, QPolygonF polygon)
          Maps the polygon polygon, which is in this item's coordinate system, to item's coordinate system, and returns the mapped polygon.
 QPolygonF mapToItem(QGraphicsItemInterface item, QRectF rect)
          Maps the rectangle rect, which is in this item's coordinate system, to item's coordinate system, and returns the mapped rectangle as a polygon.
 QPointF mapToParent(double x, double y)
          This convenience function is equivalent to calling mapToParent(QPointF(x, y)).
 QPolygonF mapToParent(double x, double y, double w, double h)
          This convenience function is equivalent to calling mapToParent(QRectF(x, y, w, h)).
 QPainterPath mapToParent(QPainterPath path)
          Maps the path path, which is in this item's coordinate system, to its parent's coordinate system, and returns the mapped path.
 QPointF mapToParent(QPointF point)
          Maps the point point, which is in this item's coordinate system, to its parent's coordinate system, and returns the mapped coordinate.
 QPolygonF mapToParent(QPolygonF polygon)
          Maps the polygon polygon, which is in this item's coordinate system, to its parent's coordinate system, and returns the mapped polygon.
 QPolygonF mapToParent(QRectF rect)
          Maps the rectangle rect, which is in this item's coordinate system, to its parent's coordinate system, and returns the mapped rectangle as a polygon.
 QPointF mapToScene(double x, double y)
          This convenience function is equivalent to calling mapToScene(QPointF(x, y)).
 QPolygonF mapToScene(double x, double y, double w, double h)
          This convenience function is equivalent to calling mapToScene(QRectF(x, y, w, h)).
 QPainterPath mapToScene(QPainterPath path)
          Maps the path path, which is in this item's coordinate system, to the scene's coordinate system, and returns the mapped path.
 QPointF mapToScene(QPointF point)
          Maps the point point, which is in this item's coordinate system, to the scene's coordinate system, and returns the mapped coordinate.
 QPolygonF mapToScene(QPolygonF polygon)
          Maps the polygon polygon, which is in this item's coordinate system, to the scene's coordinate system, and returns the mapped polygon.
 QPolygonF mapToScene(QRectF rect)
          Maps the rectangle rect, which is in this item's coordinate system, to the scene's coordinate system, and returns the mapped rectangle as a polygon.
 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent event)
          This function is reimplemented for internal reasons.
 void mouseMoveEvent(QGraphicsSceneMouseEvent event)
          This function is reimplemented for internal reasons.
 void mousePressEvent(QGraphicsSceneMouseEvent event)
          This function is reimplemented for internal reasons.
 void mouseReleaseEvent(QGraphicsSceneMouseEvent event)
          This function is reimplemented for internal reasons.
 void moveBy(double dx, double dy)
          Moves the item by dx points horizontally, and dy point vertically.
 QPainterPath opaqueArea()
          This function is reimplemented for internal reasons.
 boolean openExternalLinks()
          Specifies whether QGraphicsTextItem should automatically open links using QDesktopServices::openUrl() instead of emitting the anchorClicked signal.
 void paint(QPainter painter, QStyleOptionGraphicsItem option, QWidget widget)
          This function is reimplemented for internal reasons.
 QGraphicsItemInterface parentItem()
          Returns a pointer to this item's parent item.
 QPointF pos()
          Returns the position of the item in parent coordinates.
 void prepareGeometryChange()
          Prepares the item for a geometry change.
 void removeFromIndex()
          
 void removeSceneEventFilter(QGraphicsItemInterface filterItem)
          Removes an event filter on this item from filterItem.
 void resetTransform()
          Resets this item's transformation matrix to the identity matrix.
 void rotate(double angle)
          Rotates the current item transformation angle degrees clockwise around its origin.
 void scale(double sx, double sy)
          Scales the current item transformation by (sx, sy) around its origin.
 QGraphicsScene scene()
          Returns the current scene for the item, or 0 if the item is not stored in a scene.
 QRectF sceneBoundingRect()
          Returns the bounding rect of this item in scene coordinates, by combining sceneTransform with boundingRect.
 boolean sceneEvent(QEvent event)
          This function is reimplemented for internal reasons.
 boolean sceneEventFilter(QGraphicsItemInterface watched, QEvent event)
          Filters events for the item watched.
 QPointF scenePos()
          Returns the item's position in scene coordinates.
 QTransform sceneTransform()
          Returns this item's scene transformation matrix.
 void setAcceptDrops(boolean on)
          If on is true, this item will accept drag and drop events; otherwise, it is transparent for drag and drop events.
 void setAcceptedMouseButtons(Qt.MouseButtons buttons)
          Sets the mouse buttons that this item accepts mouse events for.
 void setAcceptsHoverEvents(boolean enabled)
          If enabled is true, this item will accept hover events; otherwise, it will ignore them.
 void setCursor(QCursor cursor)
          Sets the current cursor shape for the item to cursor.
 void setData(int key, java.lang.Object value)
          Sets this item's custom data for the key key to value.
 void setDefaultTextColor(QColor c)
          Sets the color for unformatted text to c.
 void setDocument(QTextDocument document)
          Sets the text document document on the item.
 void setEnabled(boolean enabled)
          If enabled is true, the item is enabled; otherwise, it is disabled.
 void setExtension(QGraphicsItem.Extension extension, java.lang.Object variant)
          
 void setFlag(QGraphicsItem.GraphicsItemFlag flag, boolean enabled)
          If enabled is true, the item flag flag is enabled; otherwise, it is disabled.
 void setFlags(QGraphicsItem.GraphicsItemFlags flags)
          Sets the item flags to flags.
 void setFocus(Qt.FocusReason focusReason)
          Gives keyboard input focus to this item.
 void setFont(QFont font)
          Sets the font used to render the text item to font.
 void setGroup(QGraphicsItemGroup group)
          Adds this item to the item group group.
 void setHandlesChildEvents(boolean enabled)
          If enabled is true, this item is set to handle all events for all its children (i.e., all events intented for any of its children are instead sent to this item); otherwise, if enabled is false, this item will only handle its own events.
 void setHtml(java.lang.String html)
          Sets the item's text to html, assuming that text is HTML formatted.
 void setOpenExternalLinks(boolean open)
          Specifies whether QGraphicsTextItem should automatically open links using QDesktopServices::openUrl() instead of emitting the anchorClicked signal.
 void setParentItem(QGraphicsItemInterface parent)
          Sets this item's parent item to parent.
 void setPlainText(java.lang.String text)
          Sets the item's text to text.
 void setPos(double x, double y)
          This convenience function is equivalent to calling setPos(QPointF(x, y)).
 void setPos(QPointF pos)
          Sets the position of the item to pos, which is in parent coordinates.
 void setSelected(boolean selected)
          If selected is true and this item is selectable, this item is selected; otherwise, it is unselected.
 void setTextCursor(QTextCursor cursor)
          This property represents the visible text cursor in an editable text item.
 void setTextInteractionFlags(Qt.TextInteractionFlag... flags)
          Sets the flags flags to specify how the text item should react to user input.
 void setTextInteractionFlags(Qt.TextInteractionFlags flags)
          Sets the flags flags to specify how the text item should react to user input.
 void setTextWidth(double width)
          Sets the preferred width for the item's text.
 void setToolTip(java.lang.String toolTip)
          Sets the item's tool tip to toolTip.
 void setTransform(QTransform matrix, boolean combine)
          Sets the item's current transformation matrix to matrix.
 void setVisible(boolean visible)
          If visible is true, the item is made visible.
 void setZValue(double z)
          Sets the Z-value, or the elevation, of the item, to z.
 QPainterPath shape()
          This function is reimplemented for internal reasons.
 void shear(double sh, double sv)
          Shears the current item transformation by (sh, sv).
 void show()
          Shows the item.
 boolean supportsExtension(QGraphicsItem.Extension extension)
          
 QTextCursor textCursor()
          This property represents the visible text cursor in an editable text item.
 Qt.TextInteractionFlags textInteractionFlags()
          Returns the current text interaction flags.
 double textWidth()
          Returns the text width.
 java.lang.String toHtml()
          Returns the item's text converted to HTML, or an empty QString if no text has been set.
 java.lang.String toolTip()
          Returns the item's tool tip, or an empty QString if no tool tip has been set.
 java.lang.String toPlainText()
          Returns the item's text converted to plain text, or an empty QString if no text has been set.
 QGraphicsItemInterface topLevelItem()
          Returns this item's top-level item.
 QTransform transform()
          Returns this item's transformation matrix.
 void translate(double dx, double dy)
          Translates the current item transformation by (dx, dy).
 int type()
          This function is reimplemented for internal reasons.
 void unsetCursor()
          Clears the cursor from this item.
 void update(double x, double y, double width, double height)
          This convenience function is equivalent to calling update(QRectF(x, y, width, height)).
 void update(QRectF rect)
          Schedules a redraw of the area covered by rect in this item.
 void wheelEvent(QGraphicsSceneWheelEvent event)
          This event handler, for event event, can be reimplemented to receive wheel events for this item.
 double x()
          This convenience function is equivalent to calling pos.
 double y()
          This convenience function is equivalent to calling pos.
 double zValue()
          Returns the Z-value, or the elevation, of the item.
 
Methods inherited from class com.trolltech.qt.core.QObject
blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
disconnect, disconnect, signalSender
 
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
 

Field Detail

linkActivated

public final QSignalEmitter.Signal1<java.lang.String> linkActivated

This signal is emitted when the user clicks on a link on a text item that enables Qt::LinksAccessibleByMouse or Qt::LinksAccessibleByKeyboard. arg__1 is the link that was clicked.

Compatible Slot Signatures:
void mySlot(java.lang.String arg__1)
void mySlot()
See Also:
setTextInteractionFlags


linkHovered

public final QSignalEmitter.Signal1<java.lang.String> linkHovered

This signal is emitted when the user hovers over a link on a text item that enables Qt::LinksAccessibleByMouse. arg__1 is the link that was hovered over.

Compatible Slot Signatures:
void mySlot(java.lang.String arg__1)
void mySlot()
See Also:
setTextInteractionFlags

Constructor Detail

QGraphicsTextItem

public QGraphicsTextItem(QGraphicsItemInterface parent)

Equivalent to QGraphicsTextItem(parent, 0).


QGraphicsTextItem

public QGraphicsTextItem()

Equivalent to QGraphicsTextItem(, 0).


QGraphicsTextItem

public QGraphicsTextItem(QGraphicsItemInterface parent,
                         QGraphicsScene scene)

Constructs a QGraphicsTextItem, using parent as the default plain text. scene is passed to QGraphicsItem's constructor.

See Also:
QGraphicsScene::addItem

QGraphicsTextItem

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


QGraphicsTextItem

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


QGraphicsTextItem

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

Method Detail

acceptDrops

public final boolean acceptDrops()

Returns true if this item can accept drag and drop events; otherwise, returns false. By default, items do not accept drag and drop events; items are transparent to drag and drop.

Specified by:
acceptDrops in interface QGraphicsItemInterface
See Also:
setAcceptDrops

acceptedMouseButtons

public final Qt.MouseButtons acceptedMouseButtons()

Returns the mouse buttons that this item accepts mouse events for. By default, all mouse buttons are accepted.

If an item accepts a mouse button, it will become the mouse grabber item when a mouse press event is delivered for that mouse button. However, if the item does not accept the button, QGraphicsScene will forward the mouse events to the first item beneath it that does.

Specified by:
acceptedMouseButtons in interface QGraphicsItemInterface
See Also:
setAcceptedMouseButtons, mousePressEvent

acceptsHoverEvents

public final boolean acceptsHoverEvents()

Returns true if an item accepts hover events (QGraphicsSceneHoverEvent); otherwise, returns false. By default, items do not accept hover events.

Specified by:
acceptsHoverEvents in interface QGraphicsItemInterface
See Also:
setAcceptsHoverEvents, setAcceptedMouseButtons

addToIndex

public final void addToIndex()

Specified by:
addToIndex in interface QGraphicsItemInterface

adjustSize

public final void adjustSize()

Adjusts the text item to a reasonable size.


childItems

public final java.util.List<QGraphicsItemInterface> childItems()

Returns a list of child objects. The QObjectList class is defined in the <QObject> header file as the following:

    typedef QList<QObject*> QObjectList;

The first child added is the first object in the list and the last child added is the last object in the list, i.e. new children are appended at the end.

Note that the list order changes when QWidget children are raised or lowered. A widget that is raised becomes the last object in the list, and a widget that is lowered becomes the first object in the list.

Specified by:
childItems in interface QGraphicsItemInterface
See Also:
findChild, findChildren, parent, setParent

childrenBoundingRect

public final QRectF childrenBoundingRect()

Returns the bounding rect of this item's descendents (i.e., its children, their children, etc.) in local coordinates. If the item has no children, this function returns an empty QRectF.

This does not include this item's own bounding rect; it only returns its descendents' accumulated bounding rect. If you need to include this item's bounding rect, you can add boundingRect to childrenBoundingRect using QRectF::operator|().

This function is linear in complexity; it determines the size of the returned bounding rect by iterating through all descendents.

Specified by:
childrenBoundingRect in interface QGraphicsItemInterface
See Also:
boundingRect, sceneBoundingRect

clearFocus

public final void clearFocus()

Takes keyboard input focus from the item.

If it has focus, a focus out event is sent to this item to tell it that it is about to lose the focus.

Only items that set the ItemIsFocusable flag can accept keyboard focus.

Specified by:
clearFocus in interface QGraphicsItemInterface
See Also:
setFocus

collidingItems

public final java.util.List<QGraphicsItemInterface> collidingItems(Qt.ItemSelectionMode mode)

Returns a list of all items that collide with this item.

The way collisions are detected is determined by mode. The default value for mode is Qt::IntersectsItemShape; All items whose shape intersects or is contained by this item's shape are returned.

Specified by:
collidingItems in interface QGraphicsItemInterface
See Also:
QGraphicsScene::collidingItems, collidesWithItem

cursor

public final QCursor cursor()

Returns the current cursor shape for the item. The mouse cursor will assume this shape when it's over this item. See the list of predefined cursor objects for a range of useful shapes.

An editor item might want to use an I-beam cursor:

    item->setCursor(Qt::IBeamCursor);

If no cursor has been set, the parent's cursor is used.

Specified by:
cursor in interface QGraphicsItemInterface
See Also:
setCursor, hasCursor, unsetCursor, QWidget::cursor, QApplication::overrideCursor

data

public final java.lang.Object data(int key)

Returns this item's custom data for the key key as a QVariant.

Custom item data is useful for storing arbitrary properties in any item. Example:

    static const int ObjectName = 0;

    QGraphicsItem *item = scene.itemAt(100, 50);
    if (item->data(ObjectName).toString().isEmpty()) {
        if (qgraphicsitem_cast<ButtonItem *>(item))
            item->setData(ObjectName, "Button");
    }

Qt does not use this feature for storing data; it is provided solely for the convenience of the user.

Specified by:
data in interface QGraphicsItemInterface
See Also:
setData

defaultTextColor

public final QColor defaultTextColor()

Returns the default text color that is used to for unformatted text.

See Also:
setDefaultTextColor

deviceTransform

public final QTransform deviceTransform(QTransform viewportTransform)

Returns this item's device transformation matrix, using viewportTransform to map from scene to device coordinates. This matrix can be used to map coordinates and geometrical shapes from this item's local coordinate system to the viewport's (or any device's) coordinate system. To map coordinates from the viewport, you must first invert the returned matrix.

Example:

    QGraphicsRectItem rect;
    rect.setPos(100, 100);

    rect.deviceTransform(view->viewportTransform()).map(QPointF(0, 0));
    // returns the item's (0, 0) point in view's viewport coordinates

    rect.deviceTransform(view->viewportTransform()).inverted().map(QPointF(100, 100));
    // returns view's viewport's (100, 100) coordinate in item coordinates

This function is the same as combining this item's scene transform with the view's viewport transform, but is also understands ItemIgnoresTransformations.

Specified by:
deviceTransform in interface QGraphicsItemInterface
See Also:
transform, setTransform, scenePos, The Graphics View Coordinate System

document

public final QTextDocument document()

Returns the item's text document.

See Also:
setDocument

ensureVisible

public final void ensureVisible(double x,
                                double y,
                                double w,
                                double h,
                                int xmargin,
                                int ymargin)

This convenience function is equivalent to calling ensureVisible(QRectF(x, y, w, h), xmargin, ymargin):

Specified by:
ensureVisible in interface QGraphicsItemInterface

ensureVisible

public final void ensureVisible(QRectF rect,
                                int xmargin,
                                int ymargin)

If this item is part of a scene that is viewed by a QGraphicsView, this convenience function will attempt to scroll the view to ensure that rect is visible inside the view's viewport. If rect is a null rect (the default), QGraphicsItem will default to the item's bounding rect. xmargin and ymargin are the number of pixels the view should use for margins.

If the specified rect cannot be reached, the contents are scrolled to the nearest valid position.

If this item is not viewed by a QGraphicsView, this function does nothing.

Specified by:
ensureVisible in interface QGraphicsItemInterface
See Also:
QGraphicsView::ensureVisible

flags

public final QGraphicsItem.GraphicsItemFlags flags()

Returns this item's flags. The flags describe what configurable features of the item are enabled and not. For example, if the flags include ItemIsFocusable, the item can accept input focus.

By default, no flags are enabled.

Specified by:
flags in interface QGraphicsItemInterface
See Also:
setFlags, setFlag

font

public final QFont font()

Returns the item's font, which is used to render the text.

See Also:
setFont

group

public final QGraphicsItemGroup group()

Returns a pointer to this item's item group, or 0 if this item is not member of a group.

Specified by:
group in interface QGraphicsItemInterface
See Also:
setGroup, QGraphicsItemGroup, QGraphicsScene::createItemGroup

handlesChildEvents

public final boolean handlesChildEvents()

Returns true if this item handles child events (i.e., all events intended for any of its children are instead sent to this item); otherwise, false is returned.

This property is useful for item groups; it allows one item to handle events on behalf of its children, as opposed to its children handling their events individually.

The default is to return false; children handle their own events. The exception for this is if the item is a QGraphicsItemGroup, then it defaults to return true.

Specified by:
handlesChildEvents in interface QGraphicsItemInterface
See Also:
setHandlesChildEvents

hasCursor

public final boolean hasCursor()

Returns true if this item has a cursor set; otherwise, false is returned.

By default, items don't have any cursor set. cursor will return a standard pointing arrow cursor.

Specified by:
hasCursor in interface QGraphicsItemInterface
See Also:
unsetCursor

hasFocus

public final boolean hasFocus()

Returns true if this item has focus (i.e., can accept key events); otherwise, returns false.

Specified by:
hasFocus in interface QGraphicsItemInterface
See Also:
setFocus, QGraphicsScene::setFocusItem

hide

public final void hide()

Hides the item. (Items are visible by default.)

This convenience function is equivalent to calling setVisible(false).

Specified by:
hide in interface QGraphicsItemInterface
See Also:
show, setVisible

installSceneEventFilter

public final void installSceneEventFilter(QGraphicsItemInterface filterItem)

Installs an event filter for this item on filterItem, causing all events for this item to first pass through filterItem's sceneEventFilter function.

To filter another item's events, install this item as an event filter for the other item. Example:

    QGraphicsScene scene;
    QGraphicsEllipseItem *ellipse = scene.addEllipse(QRectF(-10, -10, 20, 20));
    QGraphicsLineItem *line = scene.addLine(QLineF(-10, -10, 20, 20));

    line->installSceneEventFilter(ellipse);
    // line's events are filtered by ellipse's sceneEventFilter() function.

    ellipse->installSceneEventFilter(line);
    // ellipse's events are filtered by line's sceneEventFilter() function.

An item can only filter events for other items in the same scene. Also, an item cannot filter its own events; instead, you can reimplement sceneEvent directly.

Specified by:
installSceneEventFilter in interface QGraphicsItemInterface
See Also:
removeSceneEventFilter, sceneEventFilter, sceneEvent

isAncestorOf

public final boolean isAncestorOf(QGraphicsItemInterface child)

Returns true if this item is an ancestor of child (i.e., if this item is child's parent, or one of child's parent's ancestors).

Specified by:
isAncestorOf in interface QGraphicsItemInterface
See Also:
parentItem

isEnabled

public final boolean isEnabled()

Returns true if the item is enabled; otherwise, false is returned.

Specified by:
isEnabled in interface QGraphicsItemInterface
See Also:
setEnabled

isObscured

public final boolean isObscured()

Returns true if this item's bounding rect is completely obscured by the opaque shape of any of colliding items above it (i.e., with a higher Z value than this item).

Its implementation is based on calling isObscuredBy, which you can reimplement to provide a custom obscurity algorithm.

Specified by:
isObscured in interface QGraphicsItemInterface
See Also:
opaqueArea

isObscured

public final boolean isObscured(QRectF rect)

Returns true if rect is completely obscured by the opaque shape of any of colliding items above it (i.e., with a higher Z value than this item).

Unlike the default isObscured function, this function does not call isObscuredBy.

Specified by:
isObscured in interface QGraphicsItemInterface
See Also:
opaqueArea

isObscured

public final boolean isObscured(double x,
                                double y,
                                double w,
                                double h)

This convenience function is equivalent to calling isObscured(QRectF(x, y, w, h)).

Specified by:
isObscured in interface QGraphicsItemInterface

isSelected

public final boolean isSelected()

Returns true if this item is selected; otherwise, false is returned.

Items that are in a group inherit the group's selected state.

Items are not selected by default.

Specified by:
isSelected in interface QGraphicsItemInterface
See Also:
setSelected, QGraphicsScene::setSelectionArea

isVisible

public final boolean isVisible()

Returns true if the item is visible; otherwise, false is returned.

Note that the item's general visibility is unrelated to whether or not it is actually being visualized by a QGraphicsView.

Specified by:
isVisible in interface QGraphicsItemInterface
See Also:
setVisible

mapFromItem

public final QPointF mapFromItem(QGraphicsItemInterface item,
                                 double x,
                                 double y)

This convenience function is equivalent to calling mapFromItem(item, QPointF(x, y)).

Specified by:
mapFromItem in interface QGraphicsItemInterface

mapFromItem

public final QPolygonF mapFromItem(QGraphicsItemInterface item,
                                   QPolygonF polygon)

Maps the polygon polygon, which is in item's coordinate system, to this item's coordinate system, and returns the mapped polygon.

If item is 0, this function returns the same as mapFromScene.

Specified by:
mapFromItem in interface QGraphicsItemInterface
See Also:
mapToItem, mapFromParent, transform, The Graphics View Coordinate System

mapFromItem

public final QPolygonF mapFromItem(QGraphicsItemInterface item,
                                   QRectF rect)

Maps the rectangle rect, which is in item's coordinate system, to this item's coordinate system, and returns the mapped rectangle as a polygon.

If item is 0, this function returns the same as mapFromScene

Specified by:
mapFromItem in interface QGraphicsItemInterface
See Also:
mapToItem, mapFromParent, transform, The Graphics View Coordinate System

mapFromItem

public final QPainterPath mapFromItem(QGraphicsItemInterface item,
                                      QPainterPath path)

Maps the path path, which is in item's coordinate system, to this item's coordinate system, and returns the mapped path.

If item is 0, this function returns the same as mapFromScene.

Specified by:
mapFromItem in interface QGraphicsItemInterface
See Also:
mapFromParent, mapFromScene, mapToItem, The Graphics View Coordinate System

mapFromItem

public final QPolygonF mapFromItem(QGraphicsItemInterface item,
                                   double x,
                                   double y,
                                   double w,
                                   double h)

This convenience function is equivalent to calling mapFromItem(item, QRectF(x, y, w, h)).

Specified by:
mapFromItem in interface QGraphicsItemInterface

mapFromItem

public final QPointF mapFromItem(QGraphicsItemInterface item,
                                 QPointF point)

Maps the point point, which is in item's coordinate system, to this item's coordinate system, and returns the mapped coordinate.

If item is 0, this function returns the same as mapFromScene.

Specified by:
mapFromItem in interface QGraphicsItemInterface
See Also:
mapFromParent, mapFromScene, transform, mapToItem, The Graphics View Coordinate System

mapFromParent

public final QPolygonF mapFromParent(QRectF rect)

Maps the rectangle rect, which is in this item's parent's coordinate system, to this item's coordinate system, and returns the mapped rectangle as a polygon.

Specified by:
mapFromParent in interface QGraphicsItemInterface
See Also:
mapToParent, mapFromItem, transform, The Graphics View Coordinate System

mapFromParent

public final QPointF mapFromParent(QPointF point)

Maps the point point, which is in this item's parent's coordinate system, to this item's coordinate system, and returns the mapped coordinate.

Specified by:
mapFromParent in interface QGraphicsItemInterface
See Also:
mapFromItem, mapFromScene, transform, mapToParent, The Graphics View Coordinate System

mapFromParent

public final QPainterPath mapFromParent(QPainterPath path)

Maps the path path, which is in this item's parent's coordinate system, to this item's coordinate system, and returns the mapped path.

Specified by:
mapFromParent in interface QGraphicsItemInterface
See Also:
mapFromScene, mapFromItem, mapToParent, The Graphics View Coordinate System

mapFromParent

public final QPointF mapFromParent(double x,
                                   double y)

This convenience function is equivalent to calling mapFromParent(QPointF(x, y)).

Specified by:
mapFromParent in interface QGraphicsItemInterface

mapFromParent

public final QPolygonF mapFromParent(double x,
                                     double y,
                                     double w,
                                     double h)

This convenience function is equivalent to calling mapFromItem(QRectF(x, y, w, h)).

Specified by:
mapFromParent in interface QGraphicsItemInterface

mapFromParent

public final QPolygonF mapFromParent(QPolygonF polygon)

Maps the polygon polygon, which is in this item's parent's coordinate system, to this item's coordinate system, and returns the mapped polygon.

Specified by:
mapFromParent in interface QGraphicsItemInterface
See Also:
mapToParent, mapToItem, transform, The Graphics View Coordinate System

mapFromScene

public final QPointF mapFromScene(QPointF point)

Maps the point point, which is in this item's scene's coordinate system, to this item's coordinate system, and returns the mapped coordinate.

Specified by:
mapFromScene in interface QGraphicsItemInterface
See Also:
mapFromItem, mapFromParent, transform, mapToScene, The Graphics View Coordinate System

mapFromScene

public final QPolygonF mapFromScene(QRectF rect)

Maps the rectangle rect, which is in this item's scene's coordinate system, to this item's coordinate system, and returns the mapped rectangle as a polygon.

Specified by:
mapFromScene in interface QGraphicsItemInterface
See Also:
mapToScene, mapFromItem, transform, The Graphics View Coordinate System

mapFromScene

public final QPolygonF mapFromScene(QPolygonF polygon)

Maps the polygon polygon, which is in this item's scene's coordinate system, to this item's coordinate system, and returns the mapped polygon.

Specified by:
mapFromScene in interface QGraphicsItemInterface
See Also:
mapToScene, mapFromParent, transform, The Graphics View Coordinate System

mapFromScene

public final QPointF mapFromScene(double x,
                                  double y)

This convenience function is equivalent to calling mapFromScene(QPointF(x, y)).

Specified by:
mapFromScene in interface QGraphicsItemInterface

mapFromScene

public final QPolygonF mapFromScene(double x,
                                    double y,
                                    double w,
                                    double h)

This convenience function is equivalent to calling mapFromScene(QRectF(x, y, w, h)).

Specified by:
mapFromScene in interface QGraphicsItemInterface

mapFromScene

public final QPainterPath mapFromScene(QPainterPath path)

Maps the path path, which is in this item's scene's coordinate system, to this item's coordinate system, and returns the mapped path.

Specified by:
mapFromScene in interface QGraphicsItemInterface
See Also:
mapFromParent, mapFromItem, mapToScene, The Graphics View Coordinate System

mapToItem

public final QPointF mapToItem(QGraphicsItemInterface item,
                               QPointF point)

Maps the point point, which is in this item's coordinate system, to item's coordinate system, and returns the mapped coordinate.

If item is 0, this function returns the same as mapToScene.

Specified by:
mapToItem in interface QGraphicsItemInterface
See Also:
mapToParent, mapToScene, transform, mapFromItem, The Graphics View Coordinate System

mapToItem

public final QPolygonF mapToItem(QGraphicsItemInterface item,
                                 double x,
                                 double y,
                                 double w,
                                 double h)

This convenience function is equivalent to calling mapToItem(item, QRectF(x, y, w, h)).

Specified by:
mapToItem in interface QGraphicsItemInterface

mapToItem

public final QPainterPath mapToItem(QGraphicsItemInterface item,
                                    QPainterPath path)

Maps the path path, which is in this item's coordinate system, to item's coordinate system, and returns the mapped path.

If item is 0, this function returns the same as mapToScene.

Specified by:
mapToItem in interface QGraphicsItemInterface
See Also:
mapToParent, mapToScene, mapFromItem, The Graphics View Coordinate System

mapToItem

public final QPointF mapToItem(QGraphicsItemInterface item,
                               double x,
                               double y)

This convenience function is equivalent to calling mapToItem(item, QPointF(x, y)).

Specified by:
mapToItem in interface QGraphicsItemInterface

mapToItem

public final QPolygonF mapToItem(QGraphicsItemInterface item,
                                 QRectF rect)

Maps the rectangle rect, which is in this item's coordinate system, to item's coordinate system, and returns the mapped rectangle as a polygon.

If item is 0, this function returns the same as mapToScene.

Specified by:
mapToItem in interface QGraphicsItemInterface
See Also:
mapToParent, mapToScene, mapFromItem, The Graphics View Coordinate System

mapToItem

public final QPolygonF mapToItem(QGraphicsItemInterface item,
                                 QPolygonF polygon)

Maps the polygon polygon, which is in this item's coordinate system, to item's coordinate system, and returns the mapped polygon.

If item is 0, this function returns the same as mapToScene.

Specified by:
mapToItem in interface QGraphicsItemInterface
See Also:
mapToParent, mapToScene, mapFromItem, The Graphics View Coordinate System

mapToParent

public final QPolygonF mapToParent(QPolygonF polygon)

Maps the polygon polygon, which is in this item's coordinate system, to its parent's coordinate system, and returns the mapped polygon. If the item has no parent, polygon will be mapped to the scene's coordinate system.

Specified by:
mapToParent in interface QGraphicsItemInterface
See Also:
mapToScene, mapToItem, mapFromParent, The Graphics View Coordinate System

mapToParent

public final QPolygonF mapToParent(double x,
                                   double y,
                                   double w,
                                   double h)

This convenience function is equivalent to calling mapToParent(QRectF(x, y, w, h)).

Specified by:
mapToParent in interface QGraphicsItemInterface

mapToParent

public final QPolygonF mapToParent(QRectF rect)

Maps the rectangle rect, which is in this item's coordinate system, to its parent's coordinate system, and returns the mapped rectangle as a polygon. If the item has no parent, rect will be mapped to the scene's coordinate system.

Specified by:
mapToParent in interface QGraphicsItemInterface
See Also:
mapToScene, mapToItem, mapFromParent, The Graphics View Coordinate System

mapToParent

public final QPainterPath mapToParent(QPainterPath path)

Maps the path path, which is in this item's coordinate system, to its parent's coordinate system, and returns the mapped path. If the item has no parent, path will be mapped to the scene's coordinate system.

Specified by:
mapToParent in interface QGraphicsItemInterface
See Also:
mapToScene, mapToItem, mapFromParent, The Graphics View Coordinate System

mapToParent

public final QPointF mapToParent(QPointF point)

Maps the point point, which is in this item's coordinate system, to its parent's coordinate system, and returns the mapped coordinate. If the item has no parent, point will be mapped to the scene's coordinate system.

Specified by:
mapToParent in interface QGraphicsItemInterface
See Also:
mapToItem, mapToScene, transform, mapFromParent, The Graphics View Coordinate System

mapToParent

public final QPointF mapToParent(double x,
                                 double y)

This convenience function is equivalent to calling mapToParent(QPointF(x, y)).

Specified by:
mapToParent in interface QGraphicsItemInterface

mapToScene

public final QPointF mapToScene(QPointF point)

Maps the point point, which is in this item's coordinate system, to the scene's coordinate system, and returns the mapped coordinate.

Specified by:
mapToScene in interface QGraphicsItemInterface
See Also:
mapToItem, mapToParent, transform, mapFromScene, The Graphics View Coordinate System

mapToScene

public final QPainterPath mapToScene(QPainterPath path)

Maps the path path, which is in this item's coordinate system, to the scene's coordinate system, and returns the mapped path.

Specified by:
mapToScene in interface QGraphicsItemInterface
See Also:
mapToParent, mapToItem, mapFromScene, The Graphics View Coordinate System

mapToScene

public final QPointF mapToScene(double x,
                                double y)

This convenience function is equivalent to calling mapToScene(QPointF(x, y)).

Specified by:
mapToScene in interface QGraphicsItemInterface

mapToScene

public final QPolygonF mapToScene(QPolygonF polygon)

Maps the polygon polygon, which is in this item's coordinate system, to the scene's coordinate system, and returns the mapped polygon.

Specified by:
mapToScene in interface QGraphicsItemInterface
See Also:
mapToParent, mapToItem, mapFromScene, The Graphics View Coordinate System

mapToScene

public final QPolygonF mapToScene(double x,
                                  double y,
                                  double w,
                                  double h)

This convenience function is equivalent to calling mapToScene(QRectF(x, y, w, h)).

Specified by:
mapToScene in interface QGraphicsItemInterface

mapToScene

public final QPolygonF mapToScene(QRectF rect)

Maps the rectangle rect, which is in this item's coordinate system, to the scene's coordinate system, and returns the mapped rectangle as a polygon.

Specified by:
mapToScene in interface QGraphicsItemInterface
See Also:
mapToParent, mapToItem, mapFromScene, The Graphics View Coordinate System

moveBy

public final void moveBy(double dx,
                         double dy)

Moves the item by dx points horizontally, and dy point vertically. This function is equivalent to calling setPos(pos + QPointF(dx, dy)).

Specified by:
moveBy in interface QGraphicsItemInterface

openExternalLinks

public final boolean openExternalLinks()

Specifies whether QGraphicsTextItem should automatically open links using QDesktopServices::openUrl() instead of emitting the anchorClicked signal.

The default value is false.

See Also:
setOpenExternalLinks

parentItem

public final QGraphicsItemInterface parentItem()

Returns a pointer to this item's parent item. If this item does not have a parent, 0 is returned.

Specified by:
parentItem in interface QGraphicsItemInterface
See Also:
setParentItem, children

pos

public final QPointF pos()

Returns the position of the item in parent coordinates. If the item has no parent, its position is given in scene coordinates.

The position of the item describes its origin (local coordinate (0, 0)) in parent coordinates; this function returns the same as mapToParent(0, 0).

For convenience, you can also call scenePos to determine the item's position in scene coordinates, regardless of its parent.

Specified by:
pos in interface QGraphicsItemInterface
See Also:
x, y, setPos, matrix, The Graphics View Coordinate System

prepareGeometryChange

public final void prepareGeometryChange()

Prepares the item for a geometry change. Call this function before changing the bounding rect of an item to keep QGraphicsScene's index up to date.

prepareGeometryChange will call update if this is necessary.

Example:

    void CircleItem::setRadius(qreal newRadius)
    {
        if (radius != newRadius) {
            prepareGeometryChange();
            radius = newRadius;
        }
    }

Specified by:
prepareGeometryChange in interface QGraphicsItemInterface
See Also:
boundingRect

removeFromIndex

public final void removeFromIndex()

Specified by:
removeFromIndex in interface QGraphicsItemInterface

removeSceneEventFilter

public final void removeSceneEventFilter(QGraphicsItemInterface filterItem)

Removes an event filter on this item from filterItem.

Specified by:
removeSceneEventFilter in interface QGraphicsItemInterface
See Also:
installSceneEventFilter

resetTransform

public final void resetTransform()

Resets this item's transformation matrix to the identity matrix. This is equivalent to calling setTransform(QTransform()).

Specified by:
resetTransform in interface QGraphicsItemInterface
See Also:
setTransform, transform

rotate

public final void rotate(double angle)

Rotates the current item transformation angle degrees clockwise around its origin. To translate around an arbitrary point (x, y), you need to combine translation and rotation with setTransform.

Example:

    // Rotate an item 45 degrees around (0, 0).
    item->rotate(45);

    // Rotate an item 45 degrees around (x, y).
    item->setTransform(QTransform().translate(x, y).rotate(45).translate(-x, -y));

Specified by:
rotate in interface QGraphicsItemInterface
See Also:
setTransform, transform, scale, shear, translate

scale

public final void scale(double sx,
                        double sy)

Scales the current item transformation by (sx, sy) around its origin. To scale from an arbitrary point (x, y), you need to combine translation and scaling with setTransform.

Example:

    // Scale an item by 3x2 from its origin
    item->scale(3, 2);

    // Scale an item by 3x2 from (x, y)
    item->setTransform(QTransform().translate(x, y).scale(3, 2).translate(-x, -y));

Specified by:
scale in interface QGraphicsItemInterface
See Also:
setTransform, transform, rotate, shear, translate

scene

public final QGraphicsScene scene()

Returns the current scene for the item, or 0 if the item is not stored in a scene.

To add or move an item to a scene, call QGraphicsScene::addItem().

Specified by:
scene in interface QGraphicsItemInterface

sceneBoundingRect

public final QRectF sceneBoundingRect()

Returns the bounding rect of this item in scene coordinates, by combining sceneTransform with boundingRect.

Specified by:
sceneBoundingRect in interface QGraphicsItemInterface
See Also:
boundingRect, The Graphics View Coordinate System

scenePos

public final QPointF scenePos()

Returns the item's position in scene coordinates. This is equivalent to calling mapToScene(0, 0).

Specified by:
scenePos in interface QGraphicsItemInterface
See Also:
pos, sceneTransform, The Graphics View Coordinate System

sceneTransform

public final QTransform sceneTransform()

Returns this item's scene transformation matrix. This matrix can be used to map coordinates and geometrical shapes from this item's local coordinate system to the scene's coordinate system. To map coordinates from the scene, you must first invert the returned matrix.

Example:

    QGraphicsRectItem rect;
    rect.setPos(100, 100);

    rect.sceneTransform().map(QPointF(0, 0));
    // returns QPointF(100, 100);

    rect.sceneTransform().inverted().map(QPointF(100, 100));
    // returns QPointF(0, 0);

Unlike transform, which returns only an item's local transformation, this function includes the item's (and any parents') position.

Specified by:
sceneTransform in interface QGraphicsItemInterface
See Also:
transform, setTransform, scenePos, The Graphics View Coordinate System

setAcceptDrops

public final void setAcceptDrops(boolean on)

If on is true, this item will accept drag and drop events; otherwise, it is transparent for drag and drop events. By default, items do not accept drag and drop events.

Specified by:
setAcceptDrops in interface QGraphicsItemInterface
See Also:
acceptDrops

setAcceptedMouseButtons

public final void setAcceptedMouseButtons(Qt.MouseButtons buttons)

Sets the mouse buttons that this item accepts mouse events for.

By default, all mouse buttons are accepted. If an item accepts a mouse button, it will become the mouse grabber item when a mouse press event is delivered for that button. However, if the item does not accept the mouse button, QGraphicsScene will forward the mouse events to the first item beneath it that does.

To disable mouse events for an item (i.e., make it transparent for mouse events), call setAcceptedMouseButtons(0).

Specified by:
setAcceptedMouseButtons in interface QGraphicsItemInterface
See Also:
acceptedMouseButtons, mousePressEvent

setAcceptsHoverEvents

public final void setAcceptsHoverEvents(boolean enabled)

If enabled is true, this item will accept hover events; otherwise, it will ignore them. By default, items do not accept hover events.

Hover events are delivered when there is no current mouse grabber item. They are sent when the mouse cursor enters an item, when it moves around inside the item, and when the cursor leaves an item. Hover events are commonly used to highlight an item when it's entered, and for tracking the mouse cursor as it hovers over the item (equivalent to QWidget::mouseTracking).

Parent items receive hover enter events before their children, and leave events after their children. The parent does not receive a hover leave event if the cursor enters a child, though; the parent stays "hovered" until the cursor leaves its area, including its children's areas.

If a parent item handles child events (setHandlesChildEvents), it will receive hover move, drag move, and drop events as the cursor passes through its children, but it does not receive hover enter and hover leave, nor drag enter and drag leave events on behalf of its children.

Specified by:
setAcceptsHoverEvents in interface QGraphicsItemInterface
See Also:
acceptsHoverEvents, hoverEnterEvent, hoverMoveEvent, hoverLeaveEvent

setCursor

public final void setCursor(QCursor cursor)

Sets the current cursor shape for the item to cursor. The mouse cursor will assume this shape when it's over this item. See the list of predefined cursor objects for a range of useful shapes.

An editor item might want to use an I-beam cursor:

    item->setCursor(Qt::IBeamCursor);

If no cursor has been set, the cursor of the item beneath is used.

Specified by:
setCursor in interface QGraphicsItemInterface
See Also:
cursor, hasCursor, unsetCursor, QWidget::cursor, QApplication::overrideCursor

setData

public final void setData(int key,
                          java.lang.Object value)

Sets this item's custom data for the key key to value.

Custom item data is useful for storing arbitrary properties for any item. Qt does not use this feature for storing data; it is provided solely for the convenience of the user.

Specified by:
setData in interface QGraphicsItemInterface
See Also:
data

setDefaultTextColor

public final void setDefaultTextColor(QColor c)

Sets the color for unformatted text to c.

See Also:
defaultTextColor

setDocument

public final void setDocument(QTextDocument document)

Sets the text document document on the item.

See Also:
document

setEnabled

public final void setEnabled(boolean enabled)

If enabled is true, the item is enabled; otherwise, it is disabled.

Disabled items are visible, but they do not receive any events, and cannot take focus nor be selected. Mouse events are discarded; they are not propagated unless the item is also invisible, or if it does not accept mouse events (see acceptedMouseButtons). A disabled item cannot become the mouse grabber, and as a result of this, an item loses the grab if it becomes disabled when grabbing the mouse, just like it loses focus if it had focus when it was disabled.

Disabled items are traditionally drawn using grayed-out colors (see QPalette::Disabled).

If you disable a parent item, all its children will also be disabled. If you enable a parent item, all children will be enabled, unless they have been explicitly disabled (i.e., if you call setEnabled(false) on a child, it will not be reenabled if its parent is disabled, and then enabled again).

Items are enabled by default.

Specified by:
setEnabled in interface QGraphicsItemInterface
See Also:
isEnabled

setFlag

public final void setFlag(QGraphicsItem.GraphicsItemFlag flag,
                          boolean enabled)

If enabled is true, the item flag flag is enabled; otherwise, it is disabled.

Specified by:
setFlag in interface QGraphicsItemInterface
See Also:
flags, setFlags

setFlags

public final void setFlags(QGraphicsItem.GraphicsItemFlags flags)

Sets the item flags to flags. All flags in flags are enabled; all flags not in flags are disabled.

If the item had focus and flags does not enable ItemIsFocusable, the item loses focus as a result of calling this function. Similarly, if the item was selected, and flags does not enabled ItemIsSelectable, the item is automatically unselected.

By default, no flags are enabled.

Specified by:
setFlags in interface QGraphicsItemInterface
See Also:
flags, setFlag

setFocus

public final void setFocus(Qt.FocusReason focusReason)

Gives keyboard input focus to this item. The focusReason argument will be passed into any focus event generated by this function; it is used to give an explanation of what caused the item to get focus.

Only items that set the ItemIsFocusable flag can accept keyboard focus.

If this item is not visible (i.e., isVisible returns false), not enabled, not associated with a scene, or if it already has input focus, this function will do nothing.

As a result of calling this function, this item will receive a focus in event with focusReason. If another item already has focus, that item will first receive a focus out event indicating that it has lost input focus.

Specified by:
setFocus in interface QGraphicsItemInterface
See Also:
clearFocus, hasFocus

setFont

public final void setFont(QFont font)

Sets the font used to render the text item to font.

See Also:
font

setGroup

public final void setGroup(QGraphicsItemGroup group)

Adds this item to the item group group. If group is 0, this item is removed from any current group and added as a child of the previous group's parent.

Specified by:
setGroup in interface QGraphicsItemInterface
See Also:
group, QGraphicsScene::createItemGroup

setHandlesChildEvents

public final void setHandlesChildEvents(boolean enabled)

If enabled is true, this item is set to handle all events for all its children (i.e., all events intented for any of its children are instead sent to this item); otherwise, if enabled is false, this item will only handle its own events. The default value is false.

This property is useful for item groups; it allows one item to handle events on behalf of its children, as opposed to its children handling their events individually.

If a child item accepts hover events, its parent will receive hover move events as the cursor passes through the child, but it does not receive hover enter and hover leave events on behalf of its child.

Specified by:
setHandlesChildEvents in interface QGraphicsItemInterface
See Also:
handlesChildEvents

setHtml

public final void setHtml(java.lang.String html)

Sets the item's text to html, assuming that text is HTML formatted. If the item has keyboard input focus, this function will also call ensureVisible to ensure that the text is visible in all viewports.

See Also:
toHtml, hasFocus

setOpenExternalLinks

public final void setOpenExternalLinks(boolean open)

Specifies whether QGraphicsTextItem should automatically open links using QDesktopServices::openUrl() instead of emitting the anchorClicked signal.

The default value is false.

See Also:
openExternalLinks

setParentItem

public final void setParentItem(QGraphicsItemInterface parent)

Sets this item's parent item to parent. If this item already has a parent, it is first removed from the previous parent. If parent is 0, this item will become a top-level item.

Specified by:
setParentItem in interface QGraphicsItemInterface
See Also:
parentItem, children

setPlainText

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

Sets the item's text to text. If the item has keyboard input focus, this function will also call ensureVisible to ensure that the text is visible in all viewports.

See Also:
toHtml, hasFocus

setPos

public final void setPos(double x,
                         double y)

This convenience function is equivalent to calling setPos(QPointF(x, y)).

Specified by:
setPos in interface QGraphicsItemInterface
See Also:
pos

setPos

public final void setPos(QPointF pos)

Sets the position of the item to pos, which is in parent coordinates. For items with no parent, pos is in scene coordinates.

The position of the item describes its origin (local coordinate (0, 0)) in parent coordinates.

Specified by:
setPos in interface QGraphicsItemInterface
See Also:
pos, scenePos, The Graphics View Coordinate System

setSelected

public final void setSelected(boolean selected)

If selected is true and this item is selectable, this item is selected; otherwise, it is unselected.

If the item is in a group, the whole group's selected state is toggled by this function. If the group is selected, all items in the group are also selected, and if the group is not selected, no item in the group is selected.

Only visible, enabled, selectable items can be selected. If selected is true and this item is either invisible or disabled or unselectable, this function does nothing.

By default, items cannot be selected. To enable selection, set the ItemIsSelectable flag.

This function is provided for convenience, allowing individual toggling of the selected state of an item. However, a more common way of selecting items is to call QGraphicsScene::setSelectionArea(), which will call this function for all visible, enabled, and selectable items within a specified area on the scene.

Specified by:
setSelected in interface QGraphicsItemInterface
See Also:
isSelected, QGraphicsScene::selectedItems

setTextCursor

public final void setTextCursor(QTextCursor cursor)

This property represents the visible text cursor in an editable text item.

See Also:
textCursor

setTextInteractionFlags

public final void setTextInteractionFlags(Qt.TextInteractionFlag... flags)

Sets the flags flags to specify how the text item should react to user input.

The default for a QGraphicsTextItem is Qt::NoTextInteraction. Setting a value different to Qt::NoTextInteraction will also set the ItemIsFocusable QGraphicsItem flag.

By default, the text is read-only. To transform the item into an editor, set the Qt::TextEditable flag.

See Also:
textInteractionFlags

setTextInteractionFlags

public final void setTextInteractionFlags(Qt.TextInteractionFlags flags)

Sets the flags flags to specify how the text item should react to user input.

The default for a QGraphicsTextItem is Qt::NoTextInteraction. Setting a value different to Qt::NoTextInteraction will also set the ItemIsFocusable QGraphicsItem flag.

By default, the text is read-only. To transform the item into an editor, set the Qt::TextEditable flag.

See Also:
textInteractionFlags

setTextWidth

public final void setTextWidth(double width)

Sets the preferred width for the item's text. If the actual text is wider than the specified width then it will be broken into multiple lines.

If width is set to -1 then the text will not be broken into multiple lines unless it is enforced through an explicit line break or a new paragraph.

The default value is -1.

See Also:
textWidth

setToolTip

public final void setToolTip(java.lang.String toolTip)

Sets the item's tool tip to toolTip. If toolTip is empty, the item's tool tip is cleared.

Specified by:
setToolTip in interface QGraphicsItemInterface
See Also:
toolTip, QToolTip

setTransform

public final void setTransform(QTransform matrix,
                               boolean combine)

Sets the item's current transformation matrix to matrix.

If combine is true, then matrix is combined with the current matrix; otherwise, matrix replaces the current matrix. combine is false by default.

To simplify interation with items using a transformed view, QGraphicsItem provides mapTo... and mapFrom... functions that can translate between items' and the scene's coordinates. For example, you can call mapToScene to map an item coordiate to a scene coordinate, or mapFromScene to map from scene coordinates to item coordinates.

Specified by:
setTransform in interface QGraphicsItemInterface
See Also:
transform, rotate, scale, shear, translate, The Graphics View Coordinate System

setVisible

public final void setVisible(boolean visible)

If visible is true, the item is made visible. Otherwise, the item is made invisible. Invisible items are not painted, nor do they receive any events. In particular, mouse events pass right through invisible items, and are delivered to any item that may be behind. Invisible items are also unselectable, they cannot take input focus, and are not detected by QGraphicsScene's item location functions.

If an item becomes invisible while grabbing the mouse, (i.e., while it is receiving mouse events,) it will automatically lose the mouse grab, and the grab is not regained by making the item visible again; it must receive a new mouse press to regain the mouse grab.

Similarly, an invisible item cannot have focus, so if the item has focus when it becomes invisible, it will lose focus, and the focus is not regained by simply making the item visible again.

If you hide a parent item, all its children will also be hidden. If you show a parent item, all children will be shown, unless they have been explicitly hidden (i.e., if you call setVisible(false) on a child, it will not be reshown even if its parent is hidden, and then shown again).

Items are visible by default; it is unnecessary to call setVisible on a new item.

Specified by:
setVisible in interface QGraphicsItemInterface
See Also:
isVisible, show, hide

setZValue

public final void setZValue(double z)

Sets the Z-value, or the elevation, of the item, to z. The elevation decides the stacking order of sibling (neighboring) items. An item of high Z-value will be drawn on top of an item with a lower Z-value if they share the same parent item. In addition, children of an item will always be drawn on top of the parent, regardless of the child's Z-value. Sibling items that share the same Z-value will be drawn in an undefined order, although the order will stay the same for as long as the items live.

Children of different parents are stacked according to the Z-value of each item's ancestor item which is an immediate child of the two items' closest common ancestor. For example, a robot item might define a torso item as the parent of a head item, two arm items, and two upper-leg items. The upper-leg items would each be parents of one lower-leg item, and each lower-leg item would be parents of one foot item. The stacking order of the feet is the same as the stacking order of each foot's ancestor that is an immediate child of the two feet's common ancestor (i.e., the torso item); so the feet are stacked in the same order as the upper-leg items, regardless of each foot's Z-value.

The Z-value does not affect the item's size in any way.

The default Z-value is 0.

Specified by:
setZValue in interface QGraphicsItemInterface
See Also:
zValue

shear

public final void shear(double sh,
                        double sv)

Shears the current item transformation by (sh, sv).

Specified by:
shear in interface QGraphicsItemInterface
See Also:
setTransform, transform, rotate, scale, translate

show

public final void show()

Shows the item. (Items are visible by default.)

This convenience function is equivalent to calling setVisible(true).

Specified by:
show in interface QGraphicsItemInterface
See Also:
hide, setVisible

textCursor

public final QTextCursor textCursor()

This property represents the visible text cursor in an editable text item.

See Also:
setTextCursor

textInteractionFlags

public final Qt.TextInteractionFlags textInteractionFlags()

Returns the current text interaction flags.

See Also:
setTextInteractionFlags

textWidth

public final double textWidth()

Returns the text width.

See Also:
setTextWidth

toHtml

public final java.lang.String toHtml()

Returns the item's text converted to HTML, or an empty QString if no text has been set.

See Also:
setHtml

toPlainText

public final java.lang.String toPlainText()

Returns the item's text converted to plain text, or an empty QString if no text has been set.

See Also:
setPlainText

toolTip

public final java.lang.String toolTip()

Returns the item's tool tip, or an empty QString if no tool tip has been set.

Specified by:
toolTip in interface QGraphicsItemInterface
See Also:
setToolTip, QToolTip

topLevelItem

public final QGraphicsItemInterface topLevelItem()

Returns this item's top-level item. The top-level item is the item's topmost ancestor item whose parent is 0. If an item has no parent, its own pointer is returned (i.e., a top-level item is its own top-level item).

Specified by:
topLevelItem in interface QGraphicsItemInterface
See Also:
parentItem

transform

public final QTransform transform()

Returns this item's transformation matrix. If no matrix has been set, the identity matrix is returned.

Specified by:
transform in interface QGraphicsItemInterface
See Also:
setTransform, sceneTransform

translate

public final void translate(double dx,
                            double dy)

Translates the current item transformation by (dx, dy).

If all you want is to move an item, you should call moveBy or setPos instead; this function changes the item's translation, which is conceptually separate from its position.

Specified by:
translate in interface QGraphicsItemInterface
See Also:
setTransform, transform, rotate, scale, shear

unsetCursor

public final void unsetCursor()

Clears the cursor from this item.

Specified by:
unsetCursor in interface QGraphicsItemInterface
See Also:
hasCursor, setCursor

update

public final void update(QRectF rect)

Schedules a redraw of the area covered by rect in this item. You can call this function whenever your item needs to be redrawn, such as if it changes appearance or size.

This function does not cause an immediate paint; instead it schedules a paint request that is processed by QGraphicsView after control reaches the event loop. The item will only be redrawn if it is visible in any associated view.

As a side effect of the item being repainted, other items that overlap the area rect may also be repainted.

If the item is invisible (i.e., isVisible returns false), this function does nothing.

Specified by:
update in interface QGraphicsItemInterface
See Also:
paint, boundingRect

update

public final void update(double x,
                         double y,
                         double width,
                         double height)

This convenience function is equivalent to calling update(QRectF(x, y, width, height)).

Specified by:
update in interface QGraphicsItemInterface

x

public final double x()

This convenience function is equivalent to calling pos.x.

Specified by:
x in interface QGraphicsItemInterface
See Also:
y

y

public final double y()

This convenience function is equivalent to calling pos.y.

Specified by:
y in interface QGraphicsItemInterface
See Also:
x

zValue

public final double zValue()

Returns the Z-value, or the elevation, of the item. The Z-value decides the stacking order of sibling (neighboring) items.

The default Z-value is 0.

Specified by:
zValue in interface QGraphicsItemInterface
See Also:
setZValue

advance

public void advance(int phase)

This virtual function is called twice for all items by the QGraphicsScene::advance() slot. In the first phase, all items are called with phase == 0, indicating that items on the scene are about to advance, and then all items are called with phase == 1. Reimplement this function to update your item if you need simple scene-controlled animation.

The default implementation does nothing.

For individual item animation, an alternative to this function is to either use QGraphicsItemAnimation, or to multiple-inherit from QObject and QGraphicsItem, and animate your item using QObject::startTimer() and QObject::timerEvent().

Specified by:
advance in interface QGraphicsItemInterface
See Also:
QGraphicsItemAnimation, QTimeLine

boundingRect

public QRectF boundingRect()

This function is reimplemented for internal reasons.

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

collidesWithItem

public boolean collidesWithItem(QGraphicsItemInterface other,
                                Qt.ItemSelectionMode mode)

Returns true if this item collides with other; otherwise returns false. The ways items collide is determined by mode. The default value for mode is Qt::IntersectsItemShape; other collides with this item if it either intersect or are contained by this item's shape.

The default implementation is based on shape intersection, and it calls shape on both items. Because the complexity of arbitrary shape-shape intersection grows with an order of magnitude when the shapes are complex, this operation can be noticably time consuming. You have the option of reimplementing this function in a subclass of QGraphicsItem to provide a custom algorithm. This allows you to make use of natural constraints in the shapes of your own items, in order to improve the performance of the collision detection. For instance, two untransformed perfectly circular items' collision can be determined very efficiently by comparing their positions and radii.

Keep in mind that when reimplementing this function and calling shape or boundingRect on other, the returned coordinates must be mapped to this item's coordinate system before any intersection can take place.

Specified by:
collidesWithItem in interface QGraphicsItemInterface
See Also:
contains, shape

collidesWithPath

public boolean collidesWithPath(QPainterPath path,
                                Qt.ItemSelectionMode mode)

Returns true if this item collides with path.

The collision is determined by mode. The default value for mode is Qt::IntersectsItemShape; path collides with this item if it either intersects or is contained by this item's shape.

Specified by:
collidesWithPath in interface QGraphicsItemInterface
See Also:
collidesWithItem, contains, shape

contains

public boolean contains(QPointF point)

This function is reimplemented for internal reasons.

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

contextMenuEvent

public void contextMenuEvent(QGraphicsSceneContextMenuEvent event)

This function is reimplemented for internal reasons.

Specified by:
contextMenuEvent in interface QGraphicsItemInterface
See Also:
sceneEvent

dragEnterEvent

public void dragEnterEvent(QGraphicsSceneDragDropEvent event)

This function is reimplemented for internal reasons.

Specified by:
dragEnterEvent in interface QGraphicsItemInterface
See Also:
dropEvent, dragMoveEvent, dragLeaveEvent

dragLeaveEvent

public void dragLeaveEvent(QGraphicsSceneDragDropEvent event)

This function is reimplemented for internal reasons.

Specified by:
dragLeaveEvent in interface QGraphicsItemInterface
See Also:
dragEnterEvent, dropEvent, dragMoveEvent

dragMoveEvent

public void dragMoveEvent(QGraphicsSceneDragDropEvent event)

This function is reimplemented for internal reasons.

Specified by:
dragMoveEvent in interface QGraphicsItemInterface
See Also:
dropEvent, dragEnterEvent, dragLeaveEvent

dropEvent

public void dropEvent(QGraphicsSceneDragDropEvent event)

This function is reimplemented for internal reasons.

Specified by:
dropEvent in interface QGraphicsItemInterface
See Also:
dragEnterEvent, dragMoveEvent, dragLeaveEvent

extension

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

This function is reimplemented for internal reasons.

Specified by:
extension in interface QGraphicsItemInterface
See Also:
setExtension

focusInEvent

public void focusInEvent(QFocusEvent event)

This function is reimplemented for internal reasons.

Specified by:
focusInEvent in interface QGraphicsItemInterface
See Also:
focusOutEvent, sceneEvent

focusOutEvent

public void focusOutEvent(QFocusEvent event)

This function is reimplemented for internal reasons.

Specified by:
focusOutEvent in interface QGraphicsItemInterface
See Also:
focusInEvent, sceneEvent

hoverEnterEvent

public void hoverEnterEvent(QGraphicsSceneHoverEvent event)

This function is reimplemented for internal reasons.

Specified by:
hoverEnterEvent in interface QGraphicsItemInterface
See Also:
hoverMoveEvent, hoverLeaveEvent, sceneEvent, setAcceptsHoverEvents

hoverLeaveEvent

public void hoverLeaveEvent(QGraphicsSceneHoverEvent event)

This function is reimplemented for internal reasons.

Specified by:
hoverLeaveEvent in interface QGraphicsItemInterface
See Also:
hoverEnterEvent, hoverMoveEvent, sceneEvent, setAcceptsHoverEvents

hoverMoveEvent

public void hoverMoveEvent(QGraphicsSceneHoverEvent event)

This function is reimplemented for internal reasons.

Specified by:
hoverMoveEvent in interface QGraphicsItemInterface
See Also:
hoverEnterEvent, hoverLeaveEvent, sceneEvent, setAcceptsHoverEvents

inputMethodEvent

public void inputMethodEvent(QInputMethodEvent event)

This function is reimplemented for internal reasons.

Specified by:
inputMethodEvent in interface QGraphicsItemInterface
See Also:
inputMethodQuery, sceneEvent

inputMethodQuery

public java.lang.Object inputMethodQuery(Qt.InputMethodQuery query)

This function is reimplemented for internal reasons.

Specified by:
inputMethodQuery in interface QGraphicsItemInterface
See Also:
inputMethodEvent

isObscuredBy

public boolean isObscuredBy(QGraphicsItemInterface item)

This function is reimplemented for internal reasons.

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

itemChange

public java.lang.Object itemChange(QGraphicsItem.GraphicsItemChange change,
                                   java.lang.Object value)

This virtual function is called by QGraphicsItem to notify custom items that some part of the item's state changes. By reimplementing this function, your can react to a change, and in some cases, (depending on change,) adjustments can be made.

change is the parameter of the item that is changing. value is the new value; the type of the value depends on change.

Example:

    QVariant Component::itemChange(GraphicsItemChange change, const QVariant &value)
    {
        if (change == ItemPositionChange && scene()) {
            // value is the new position.
            QPointF newPos = value.toPointF();
            QRectF rect = scene()->sceneRect();
            if (!rect.contains(newPos)) {
                // Keep the item inside the scene rect.
                newPos.setX(qMin(rect.right(), qMax(newPos.x(), rect.left())));
                newPos.setY(qMin(rect.bottom(), qMax(newPos.y(), rect.top())));
                return newPos;
            }
        }
        return QGraphicsItem::itemChange(change, value);
    }

The default implementation does nothing, and returns value.

Note: Certain QGraphicsItem functions cannot be called in a reimplementation of this function; see the GraphicsItemChange documentation for details.

Specified by:
itemChange in interface QGraphicsItemInterface
See Also:
GraphicsItemChange

keyPressEvent

public void keyPressEvent(QKeyEvent event)

This function is reimplemented for internal reasons.

Specified by:
keyPressEvent in interface QGraphicsItemInterface
See Also:
keyReleaseEvent, setFocus, QGraphicsScene::setFocusItem, sceneEvent

keyReleaseEvent

public void keyReleaseEvent(QKeyEvent event)

This function is reimplemented for internal reasons.

Specified by:
keyReleaseEvent in interface QGraphicsItemInterface
See Also:
keyPressEvent, setFocus, QGraphicsScene::setFocusItem, sceneEvent

mouseDoubleClickEvent

public void mouseDoubleClickEvent(QGraphicsSceneMouseEvent event)

This function is reimplemented for internal reasons.

Specified by:
mouseDoubleClickEvent in interface QGraphicsItemInterface
See Also:
mousePressEvent, mouseMoveEvent, mouseReleaseEvent, sceneEvent

mouseMoveEvent

public void mouseMoveEvent(QGraphicsSceneMouseEvent event)

This function is reimplemented for internal reasons.

Specified by:
mouseMoveEvent in interface QGraphicsItemInterface
See Also:
mousePressEvent, mouseReleaseEvent, mouseDoubleClickEvent, sceneEvent

mousePressEvent

public void mousePressEvent(QGraphicsSceneMouseEvent event)

This function is reimplemented for internal reasons.

Specified by:
mousePressEvent in interface QGraphicsItemInterface
See Also:
mouseMoveEvent, mouseReleaseEvent, mouseDoubleClickEvent, sceneEvent

mouseReleaseEvent

public void mouseReleaseEvent(QGraphicsSceneMouseEvent event)

This function is reimplemented for internal reasons.

Specified by:
mouseReleaseEvent in interface QGraphicsItemInterface
See Also:
mousePressEvent, mouseMoveEvent, mouseDoubleClickEvent, sceneEvent

opaqueArea

public QPainterPath opaqueArea()

This function is reimplemented for internal reasons.

Specified by:
opaqueArea in interface QGraphicsItemInterface
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

sceneEvent

public boolean sceneEvent(QEvent event)

This function is reimplemented for internal reasons.

Specified by:
sceneEvent in interface QGraphicsItemInterface

sceneEventFilter

public boolean sceneEventFilter(QGraphicsItemInterface watched,
                                QEvent event)

Filters events for the item watched. event is the filtered event.

Reimplementing this function in a subclass makes it possible for the item to be used as an event filter for other items, intercepting all the events send to those items before they are able to respond.

Reimplementations must return true to prevent further processing of a given event, ensuring that it will not be delivered to the watched item, or return false to indicate that the event should be propagated further by the event system.

Specified by:
sceneEventFilter in interface QGraphicsItemInterface
See Also:
installSceneEventFilter

setExtension

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

Specified by:
setExtension in interface QGraphicsItemInterface
See Also:
extension

shape

public QPainterPath shape()

This function is reimplemented for internal reasons.

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

supportsExtension

public boolean supportsExtension(QGraphicsItem.Extension extension)

Specified by:
supportsExtension in interface QGraphicsItemInterface

type

public int type()

This function is reimplemented for internal reasons.

Specified by:
type in interface QGraphicsItemInterface

wheelEvent

public void wheelEvent(QGraphicsSceneWheelEvent event)

This event handler, for event event, can be reimplemented to receive wheel events for this item. If you reimplement this function, event will be accepted by default.

If you ignore the event, (i.e., by calling QEvent::ignore(),) it will propagate to any item beneath this item. If no items accept the event, it will be ignored by the scene, and propagate to the view (e.g., the view's vertical scroll bar).

The default implementation ignores the event.

Specified by:
wheelEvent in interface QGraphicsItemInterface
See Also:
sceneEvent

fromNativePointer

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

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

Qt Jambi Home