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 *[] items , const QStyleOptionGraphicsItem [] options )

成員函數文檔編製

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

此函數已過時。提供它是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它。

Draws the items items in the scene using painter , after the background and before the foreground are drawn. numItems is the number of items in items 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 ().