QGraphicsObject 類

QGraphicsObject 類提供基類用於所有要求信號、槽及特性的圖形項。 更多...

頭: #include <QGraphicsObject>
qmake: QT += widgets
Since: Qt 4.6
繼承: QObject and QGraphicsItem
繼承者:

QGraphicsSvgItem , QGraphicsTextItem ,和 QGraphicsWidget

該類在 Qt 4.6 引入。

特性

公共函數

QGraphicsObject (QGraphicsItem * parent = nullptr)
virtual ~QGraphicsObject ()
void grabGesture (Qt::GestureType gesture , Qt::GestureFlags flags = Qt::GestureFlags())
void ungrabGesture (Qt::GestureType gesture )

信號

void enabledChanged ()
void opacityChanged ()
void parentChanged ()
void rotationChanged ()
void scaleChanged ()
void visibleChanged ()
void xChanged ()
void yChanged ()
void zChanged ()

重實現保護函數

virtual bool event (QEvent * ev ) override

保護槽

void updateMicroFocus ()

詳細描述

類延伸 QGraphicsItem with QObject 的信號/槽和特性機製。它映射瞭很多 QGraphicsItem 基本 setter 和 getter 特性並為其中很多添加瞭通知信號。

父級和子級

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 ,應使用函數提供通過 QGraphicsItem , not QObject , to manage the relationships between parent and child items.

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

另請參閱 QGraphicsWidget .

特性文檔編製

effect : QGraphicsEffect * const

此特性保持附加到此項的效果

該特性在 Qt 4.7 引入。

另請參閱 QGraphicsItem::setGraphicsEffect () 和 QGraphicsItem::graphicsEffect ().

enabled : const bool

This property holds whether the item is enabled or not

此特性的聲明在 QGraphicsItem .

默認情況下,此特性為 true .

通知程序信號:

void enabledChanged ()

另請參閱 QGraphicsItem::isEnabled () 和 QGraphicsItem::setEnabled ().

opacity : const qreal

此特性保持項的不透明度

通知程序信號:

void opacityChanged ()

另請參閱 QGraphicsItem::setOpacity () 和 QGraphicsItem::opacity ().

parent : QGraphicsObject * const

This property holds the parent of the item

注意: The item's parent is set independently of the parent object returned by QObject::parent ().

通知程序信號:

void parentChanged ()

另請參閱 QGraphicsItem::setParentItem () 和 QGraphicsItem::parentObject ().

pos : const QPointF

此特性保持項的位置

另請參閱 QGraphicsItem::setPos () 和 QGraphicsItem::pos ().

rotation : const qreal

This property holds the rotation of the item in degrees.

This specifies how many degrees to rotate the item around its transformOrigin. The default rotation is 0 degrees (i.e. not rotated at all).

通知程序信號:

void rotationChanged ()

scale : const qreal

This property holds the scale of the item.

A scale of less than 1 means the item will be displayed smaller than normal, and a scale of greater than 1 means the item will be displayed larger than normal. A negative scale means the item will be mirrored.

By default, items are displayed at a scale of 1 (i.e. at their normal size).

Scaling is from the item's transformOrigin.

通知程序信號:

void scaleChanged ()

transformOriginPoint : const QPointF

This property holds the transformation origin

This property sets a specific point in the item's coordinate system as the origin for scale and rotation.

另請參閱 scale , rotation ,和 QGraphicsItem::transformOriginPoint ().

visible : const bool

This property holds whether the item is visible or not

此特性的聲明在 QGraphicsItem .

默認情況下,此特性為 true .

通知程序信號:

void visibleChanged ()

另請參閱 QGraphicsItem::isVisible () 和 QGraphicsItem::setVisible ().

x : const qreal

This property holds the x position of the item

Describes the items x position.

通知程序信號:

void xChanged ()

另請參閱 QGraphicsItem::setX () 和 setPos ().

y : const qreal

This property holds the y position of the item

Describes the items y position.

通知程序信號:

void yChanged ()

另請參閱 QGraphicsItem::setY () 和 setPos ().

z : const qreal

This property holds the z value of the item

Describes the items z value.

通知程序信號:

void zChanged ()

另請參閱 QGraphicsItem::setZValue () 和 zValue ().

成員函數文檔編製

QGraphicsObject:: QGraphicsObject ( QGraphicsItem * parent = nullptr)

Constructs a QGraphicsObject with parent .

[signal] void QGraphicsObject:: enabledChanged ()

This signal gets emitted whenever the item gets enabled or disabled.

注意: 通知程序信號對於特性 enabled .

另請參閱 isEnabled ().

[signal] void QGraphicsObject:: opacityChanged ()

This signal gets emitted whenever the opacity of the item changes

注意: 通知程序信號對於特性 opacity .

另請參閱 QGraphicsItem::opacity ().

[signal] void QGraphicsObject:: parentChanged ()

This signal gets emitted whenever the parent of the item changes

注意: 通知程序信號對於特性 parent .

[signal] void QGraphicsObject:: rotationChanged ()

This signal gets emitted whenever the rotation of the item changes.

注意: 通知程序信號對於特性 rotation .

[signal] void QGraphicsObject:: scaleChanged ()

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

注意: 通知程序信號對於特性 scale .

[protected slot] void QGraphicsObject:: updateMicroFocus ()

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

該函數在 Qt 4.7 引入。

另請參閱 QInputMethod .

[signal] void QGraphicsObject:: visibleChanged ()

This signal gets emitted whenever the visibility of the item changes

注意: 通知程序信號對於特性 visible .

另請參閱 visible .

[signal] void QGraphicsObject:: xChanged ()

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

注意: 通知程序信號對於特性 x .

另請參閱 pos ().

[signal] void QGraphicsObject:: yChanged ()

This signal gets emitted whenever the y position of the item changes.

注意: 通知程序信號對於特性 y .

另請參閱 pos ().

[signal] void QGraphicsObject:: zChanged ()

This signal gets emitted whenever the z value of the item changes.

注意: 通知程序信號對於特性 z .

另請參閱 pos ().

[虛擬] QGraphicsObject:: ~QGraphicsObject ()

析構函數。

[override virtual protected] bool QGraphicsObject:: event ( QEvent * ev )

重實現: QObject::event (QEvent *e).

void QGraphicsObject:: grabGesture ( Qt::GestureType gesture , Qt::GestureFlags flags = Qt::GestureFlags())

Subscribes the graphics object to the given gesture 采有特有 flags .

另請參閱 ungrabGesture () 和 QGestureEvent .

void QGraphicsObject:: ungrabGesture ( Qt::GestureType gesture )

Unsubscribes the graphics object from the given gesture .

另請參閱 grabGesture () 和 QGestureEvent .