Obsolete Members for QGraphicsScene

以下成员源于类 QGraphicsScene 已过时。 提供它们是为使旧源代码能继续工作。强烈建议不要在新代码中使用它们。

特性

公共函数

(obsolete) bool isSortCacheEnabled () const
(obsolete) QGraphicsItem * itemAt (const QPointF & position ) const
(obsolete) QGraphicsItem * itemAt (qreal x , qreal y ) const
(obsolete) QList<QGraphicsItem *> (qreal x , qreal y , qreal w , qreal h , Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const
(obsolete) void setSortCacheEnabled (bool enabled )

保护函数

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

特性文档编制

sortCacheEnabled : bool

This property is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

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 *[] , const QStyleOptionGraphicsItem [] options , QWidget * widget = nullptr)

此函数已过时。提供它是为使旧源代码能继续工作。强烈建议不要在新代码中使用它。

Paints the given 使用提供 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 numItems parameter is the number of items in 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->setTransform(items[i]->sceneTransform(), 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 ,或 nullptr 若在此位置没有项。

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

注意:见 () 对于通过此函数认为哪些项可见的定义。

另请参阅 (), collidingItems (),和 排序 .

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

此函数已过时。提供它是为使旧源代码能继续工作。强烈建议不要在新代码中使用它。

这是重载函数。

返回最顶可见项在指定位置通过 ( x , y ),或 nullptr 若在此位置没有项。

此方便函数相当于调用 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:: ( 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 引入。