Obsolete Members for QGraphicsView

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

公共函数

(obsolete) QMatrix matrix () const
(obsolete) void resetMatrix ()
(obsolete) void setMatrix (const QMatrix & matrix , bool combine = false)

保护函数

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

成员函数文档编制

[virtual protected] void QGraphicsView:: drawItems ( QPainter * painter , int numItems , QGraphicsItem *[] , const QStyleOptionGraphicsItem [] options )

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

Draws the items in the scene using painter , after the background and before the foreground are drawn. numItems is the number of items in and options in options . options is a list of styleoptions; one for each item. Reimplement this function to provide custom item drawing for this view.

The default implementation calls the scene's drawItems() function.

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

另请参阅 drawForeground (), drawBackground (),和 QGraphicsScene::drawItems ().

QMatrix QGraphicsView:: matrix () const

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

使用 transform () 代替。

返回用于视图的当前变换矩阵。若当前变换未设置,返回恒等矩阵。

另请参阅 setMatrix (), transform (), rotate (), scale (), shear (),和 translate ().

void QGraphicsView:: resetMatrix ()

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

使用 resetTransform () 代替。

Resets the view transformation matrix to the identity matrix.

另请参阅 resetTransform ().

void QGraphicsView:: setMatrix (const QMatrix & matrix , bool combine = false)

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

使用 setTransform () 代替。

将视图的当前变换矩阵设为 matrix .

combine 为 true,则 matrix is combined with the current matrix; otherwise, matrix 替换 the current matrix. combine is false by default.

The transformation matrix tranforms the scene into view coordinates. Using the default transformation, provided by the identity matrix, one pixel in the view represents one unit in the scene (e.g., a 10x10 rectangular item is drawn using 10x10 pixels in the view). If a 2x2 scaling matrix is applied, the scene will be drawn in 1:2 (e.g., a 10x10 rectangular item is then drawn using 20x20 pixels in the view).

范例:

QGraphicsScene scene;
scene.addText("GraphicsView rotated clockwise");
QGraphicsView view(&scene);
view.rotate(90); // the text is rendered with a 90 degree clockwise rotation
view.show();
					

To simplify interation with items using a transformed view, QGraphicsView 提供 mapTo ... and mapFrom ... functions that can translate between scene and view coordinates. For example, you can call mapToScene () to map a view coordinate to a floating point scene coordinate, or mapFromScene () to map from floating point scene coordinates to view coordinates.

另请参阅 matrix (), setTransform (), rotate (), scale (), shear (),和 translate ().