Obsolete Members for QGraphicsScene

以下成員源於類 QGraphicsScene 已過時。 提供它們是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它們。

特性

公共函數

(obsolete) QGraphicsItem * itemAt (const QPointF & position ) const
(obsolete) QGraphicsItem * itemAt (qreal x , qreal y ) const
(obsolete) QList<QGraphicsItem *> items (const QPointF & pos ) const
(obsolete) QList<QGraphicsItem *> items (qreal x , qreal y , qreal w , qreal h , Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const
(obsolete) QList<QGraphicsItem *> items (const QRectF & rectangle , Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const
(obsolete) QList<QGraphicsItem *> items (const QPolygonF & polygon , Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const
(obsolete) QList<QGraphicsItem *> items (const QPainterPath & path , Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const
(obsolete) void setSelectionArea (const QPainterPath & path )
(obsolete) void setSelectionArea (const QPainterPath & path , Qt::ItemSelectionMode mode )

保護函數

(obsolete) virtual void drawItems (QPainter * painter , int numItems , QGraphicsItem *[] items , const QStyleOptionGraphicsItem[] options , QWidget * widget = 0)

特性文檔編製

sortCacheEnabled : bool

This property holds whether sort caching is enabled.

Since Qt 4.6, this property has no effect.

該特性在 Qt 4.5 引入。

訪問函數:

bool isSortCacheEnabled () const
void setSortCacheEnabled (bool enabled )

成員函數文檔編製

[virtual protected] void QGraphicsScene:: drawItems ( QPainter * painter , int numItems , QGraphicsItem *[] items , const QStyleOptionGraphicsItem [] options , QWidget * widget = 0)

Paints the given items 使用提供 painter , after the background has been drawn, and before the foreground has been drawn. All painting is done in scene coordinates. Before drawing each item, the painter must be transformed using QGraphicsItem::sceneTransform ().

The options parameter is the list of style option objects for each item in items numItems parameter is the number of items in items and options in options widget parameter is optional; if specified, it should point to the widget that is being painted on.

The default implementation prepares the painter matrix, and calls QGraphicsItem::paint () on all items. Reimplement this function to provide custom painting of all items for the scene; gaining complete control over how each item is drawn. In some cases this can increase drawing performance significantly.

範例:

void CustomScene::drawItems(QPainter *painter, int numItems,
                            QGraphicsItem *items[],
                            const QStyleOptionGraphicsItem options[],
                            QWidget *widget)
{
    for (int i = 0; i < numItems; ++i) {
         // Draw the item
         painter->save();
         painter->setMatrix(items[i]->sceneMatrix(), true);
         items[i]->paint(painter, &options[i], widget);
         painter->restore();
     }
}
					

Since Qt 4.6, this function is not called anymore unless the QGraphicsView::IndirectPainting flag is given as an Optimization flag.

另請參閱 drawBackground () 和 drawForeground ().

QGraphicsItem * QGraphicsScene:: itemAt (const QPointF & position ) const

這是重載函數。

返迴最頂可見項在指定 position , or 0 if there are no items at this position.

This function is deprecated and returns incorrect results if the scene contains items that ignore transformations. Use the overload that takes a QTransform 代替。

另請參閱 items (), collidingItems (),和 排序 .

QGraphicsItem * QGraphicsScene:: itemAt ( qreal x , qreal y ) const

這是重載函數。

Returns the topmost item at the position specified by ( x , y ), or 0 if there are no items at this position.

此方便函數相當於調用 itemAt(QPointF(x, y)) .

This function is deprecated and returns incorrect results if the scene contains items that ignore transformations. Use the overload that takes a QTransform 代替。

QList < QGraphicsItem *> QGraphicsScene:: items (const QPointF & pos ) const

Returns all visible items at position pos in the scene. The items are listed in descending stacking order (i.e., the first item in the list is the top-most item, and the last item is the bottom-most item).

This function is deprecated and returns incorrect results if the scene contains items that ignore transformations. Use the overload that takes a QTransform 代替。

另請參閱 itemAt () 和 排序 .

QList < QGraphicsItem *> QGraphicsScene:: items ( qreal x , qreal y , qreal w , qreal h , Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const

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

This function is deprecated and returns incorrect results if the scene contains items that ignore transformations. Use the overload that takes a QTransform 代替。

該函數在 Qt 4.3 引入。

QList < QGraphicsItem *> QGraphicsScene:: items (const QRectF & rectangle , Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const

這是重載函數。

返迴的所有可見項,從屬 mode ,在內部或相交與指定 rectangle .

默認值對於 mode is Qt::IntersectsItemShape ; all items whose exact shape intersects with or is contained by rectangle 被返迴。

This function is deprecated and returns incorrect results if the scene contains items that ignore transformations. Use the overload that takes a QTransform 代替。

另請參閱 itemAt () 和 排序 .

QList < QGraphicsItem *> QGraphicsScene:: items (const QPolygonF & polygon , Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const

這是重載函數。

返迴的所有可見項,從屬 mode , are either inside or intersect with the polygon polygon .

默認值對於 mode is Qt::IntersectsItemShape ; all items whose exact shape intersects with or is contained by polygon 被返迴。

This function is deprecated and returns incorrect results if the scene contains items that ignore transformations. Use the overload that takes a QTransform 代替。

另請參閱 itemAt () 和 排序 .

QList < QGraphicsItem *> QGraphicsScene:: items (const QPainterPath & path , Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const

這是重載函數。

返迴的所有可見項,從屬 path , are either inside or intersect with the path path .

默認值對於 mode is Qt::IntersectsItemShape ; all items whose exact shape intersects with or is contained by path 被返迴。

This function is deprecated and returns incorrect results if the scene contains items that ignore transformations. Use the overload that takes a QTransform 代替。

另請參閱 itemAt () 和 排序 .

void QGraphicsScene:: setSelectionArea (const QPainterPath & path )

這是重載函數。

將選定區域設為 path .

This function is deprecated and leads to incorrect results if the scene contains items that ignore transformations. Use the overload that takes a QTransform 代替。

void QGraphicsScene:: setSelectionArea (const QPainterPath & path , Qt::ItemSelectionMode mode )

這是重載函數。

將選定區域設為 path 使用 mode 以確定項是否包括在選定區域中。

該函數在 Qt 4.3 引入。

另請參閱 clearSelection () 和 selectionArea ().