QGraphicsObject Class Reference

[ QtGui module]

The QGraphicsObject class provides a base class for all graphics items that require signals, slots and properties. 更多...

继承 QObject and QGraphicsItem .

Inherited by QDeclarativeItem , QGraphicsSvgItem , QGraphicsTextItem and QGraphicsWidget .

方法

Qt Signals


详细描述

The QGraphicsObject class provides a base class for all graphics items that require signals, slots and properties.

类扩展 QGraphicsItem with QObject 's signal/slot and property mechanisms. It maps many of QGraphicsItem 's basic setters and getters to properties and adds notification signals for many of them.

父级和子级

Each graphics object can be constructed with a parent item. This ensures that the item will be destroyed when its parent item is destroyed. Although QGraphicsObject inherits from both QObject and QGraphicsItem , you should use the functions provided by QGraphicsItem , not QObject , to manage the relationships between parent and child items.

The relationships between items can be explored using the parentItem () 和 childItems () 函数。 In the hierarchy of items in a scene, the parentObject () 和 parentWidget () functions are the equivalent of the QWidget.parent () 和 QWidget.parentWidget () functions for QWidget 子类。


方法文档编制

QGraphicsObject.__init__ ( self , QGraphicsItem   parent  = None)

parent argument, if not None, causes self to be owned by Qt instead of PyQt.

构造 QGraphicsObject with parent .

QGraphicsObject.grabGesture ( self , Qt.GestureType   type , Qt.GestureFlags   flags  = Qt.GestureFlags(0))

Subscribes the graphics object to the given gesture with specific flags .

另请参阅 ungrabGesture () 和 QGestureEvent .

QGraphicsObject.ungrabGesture ( self , Qt.GestureType   type )

Unsubscribes the graphics object from the given gesture .

另请参阅 grabGesture () 和 QGestureEvent .

QGraphicsObject.updateMicroFocus ( self )

This method is also a Qt slot with the C++ signature void updateMicroFocus() .

Updates the item's micro focus. This is slot for convenience.

该函数在 Qt 4.7 引入。

另请参阅 QInputContext .


Qt Signal Documentation

void enabledChanged ()

This is the default overload of this signal.

This signal gets emitted whenever the item get's enabled or disabled.

另请参阅 isEnabled ().

void opacityChanged ()

This is the default overload of this signal.

This signal gets emitted whenever the opacity of the item changes

另请参阅 QGraphicsItem.opacity ().

void parentChanged ()

This is the default overload of this signal.

This signal gets emitted whenever the parent of the item changes

void rotationChanged ()

This is the default overload of this signal.

This signal gets emitted whenever the roation of the item 改变。

void scaleChanged ()

This is the default overload of this signal.

This signal is emitted when the scale of the item changes.

void visibleChanged ()

This is the default overload of this signal.

This signal gets emitted whenever the visibility of the item changes

另请参阅 visible .

void xChanged ()

This is the default overload of this signal.

This signal gets emitted whenever the x position of the item changes

另请参阅 pos ().

void yChanged ()

This is the default overload of this signal.

This signal gets emitted whenever the y position of the item 改变。

另请参阅 pos ().

void zChanged ()

This is the default overload of this signal.

This signal gets emitted whenever the z value of the item 改变。

另请参阅 pos ().