<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # QGraphicsView Class Reference ## [[QtGui](index.htm) module] 該QGraphicsView類提供了一個小工具,用于顯示的內容[QGraphicsScene](qgraphicsscene.html)。[More...](#details) 繼承[QAbstractScrollArea](qabstractscrollarea.html)。 通過繼承[QDeclarativeView](qdeclarativeview.html)。 ### Types * `class **[CacheMode](index.htm)**` * `enum CacheModeFlag { CacheNone, CacheBackground }` * `enum DragMode { NoDrag, ScrollHandDrag, RubberBandDrag }` * `enum OptimizationFlag { DontClipPainter, DontSavePainterState, DontAdjustForAntialiasing }` * `class **[OptimizationFlags](index.htm)**` * `enum ViewportAnchor { NoAnchor, AnchorViewCenter, AnchorUnderMouse }` * `enum ViewportUpdateMode { FullViewportUpdate, MinimalViewportUpdate, SmartViewportUpdate, BoundingRectViewportUpdate, NoViewportUpdate }` ### Methods * `__init__ (self, QWidget?parent?=?None)` * `__init__ (self, QGraphicsScene?scene, QWidget?parent?=?None)` * `Qt.Alignment alignment (self)` * `QBrush backgroundBrush (self)` * `CacheMode cacheMode (self)` * `centerOn (self, QPointF?pos)` * `centerOn (self, QGraphicsItem?item)` * `centerOn (self, float?ax, float?ay)` * `contextMenuEvent (self, QContextMenuEvent?event)` * `dragEnterEvent (self, QDragEnterEvent?event)` * `dragLeaveEvent (self, QDragLeaveEvent?event)` * `DragMode dragMode (self)` * `dragMoveEvent (self, QDragMoveEvent?event)` * `drawBackground (self, QPainter?painter, QRectF?rect)` * `drawForeground (self, QPainter?painter, QRectF?rect)` * `drawItems (self, QPainter?painter, list-of-QGraphicsItem?items, list-of-QStyleOptionGraphicsItem?options)` * `dropEvent (self, QDropEvent?event)` * `ensureVisible (self, QRectF?rect, int?xMargin?=?50, int?yMargin?=?50)` * `ensureVisible (self, QGraphicsItem?item, int?xMargin?=?50, int?yMargin?=?50)` * `ensureVisible (self, float?x, float?y, float?w, float?h, int?xMargin?=?50, int?yMargin?=?50)` * `bool event (self, QEvent?event)` * `fitInView (self, QRectF?rect, Qt.AspectRatioMode?mode?=?Qt.IgnoreAspectRatio)` * `fitInView (self, QGraphicsItem?item, Qt.AspectRatioMode?mode?=?Qt.IgnoreAspectRatio)` * `fitInView (self, float?x, float?y, float?w, float?h, Qt.AspectRatioMode?mode?=?Qt.IgnoreAspectRatio)` * `focusInEvent (self, QFocusEvent?event)` * `bool focusNextPrevChild (self, bool?next)` * `focusOutEvent (self, QFocusEvent?event)` * `QBrush foregroundBrush (self)` * `inputMethodEvent (self, QInputMethodEvent?event)` * `QVariant inputMethodQuery (self, Qt.InputMethodQuery?query)` * `invalidateScene (self, QRectF?rect?=?QRectF(), QGraphicsScene.SceneLayers?layers?=?QGraphicsScene.AllLayers)` * `bool isInteractive (self)` * `bool isTransformed (self)` * `QGraphicsItem itemAt (self, QPoint?pos)` * `QGraphicsItem itemAt (self, int?ax, int?ay)` * `list-of-QGraphicsItem items (self)` * `list-of-QGraphicsItem items (self, QPoint?pos)` * `list-of-QGraphicsItem items (self, int?ax, int?ay)` * `list-of-QGraphicsItem items (self, int?x, int?y, int?w, int?h, Qt.ItemSelectionMode?mode?=?Qt.IntersectsItemShape)` * `list-of-QGraphicsItem items (self, QRect?rect, Qt.ItemSelectionMode?mode?=?Qt.IntersectsItemShape)` * `list-of-QGraphicsItem items (self, QPolygon?polygon, Qt.ItemSelectionMode?mode?=?Qt.IntersectsItemShape)` * `list-of-QGraphicsItem items (self, QPainterPath?path, Qt.ItemSelectionMode?mode?=?Qt.IntersectsItemShape)` * `keyPressEvent (self, QKeyEvent?event)` * `keyReleaseEvent (self, QKeyEvent?event)` * `QPoint mapFromScene (self, QPointF?point)` * `QPolygon mapFromScene (self, QRectF?rect)` * `QPolygon mapFromScene (self, QPolygonF?polygon)` * `QPainterPath mapFromScene (self, QPainterPath?path)` * `QPoint mapFromScene (self, float?ax, float?ay)` * `QPolygon mapFromScene (self, float?ax, float?ay, float?w, float?h)` * `QPointF mapToScene (self, QPoint?point)` * `QPolygonF mapToScene (self, QRect?rect)` * `QPolygonF mapToScene (self, QPolygon?polygon)` * `QPainterPath mapToScene (self, QPainterPath?path)` * `QPointF mapToScene (self, int?ax, int?ay)` * `QPolygonF mapToScene (self, int?ax, int?ay, int?w, int?h)` * `QMatrix matrix (self)` * `mouseDoubleClickEvent (self, QMouseEvent?event)` * `mouseMoveEvent (self, QMouseEvent?event)` * `mousePressEvent (self, QMouseEvent?event)` * `mouseReleaseEvent (self, QMouseEvent?event)` * `OptimizationFlags optimizationFlags (self)` * `paintEvent (self, QPaintEvent?event)` * `render (self, QPainter?painter, QRectF?target?=?QRectF(), QRect?source?=?QRect(), Qt.AspectRatioMode?mode?=?Qt.KeepAspectRatio)` * `QPainter.RenderHints renderHints (self)` * `resetCachedContent (self)` * `resetMatrix (self)` * `resetTransform (self)` * `ViewportAnchor resizeAnchor (self)` * `resizeEvent (self, QResizeEvent?event)` * `rotate (self, float?angle)` * `Qt.ItemSelectionMode rubberBandSelectionMode (self)` * `scale (self, float?sx, float?sy)` * `QGraphicsScene scene (self)` * `QRectF sceneRect (self)` * `scrollContentsBy (self, int?dx, int?dy)` * `setAlignment (self, Qt.Alignment?alignment)` * `setBackgroundBrush (self, QBrush?brush)` * `setCacheMode (self, CacheMode?mode)` * `setDragMode (self, DragMode?mode)` * `setForegroundBrush (self, QBrush?brush)` * `setInteractive (self, bool?allowed)` * `setMatrix (self, QMatrix?matrix, bool?combine?=?False)` * `setOptimizationFlag (self, OptimizationFlag?flag, bool?enabled?=?True)` * `setOptimizationFlags (self, OptimizationFlags?flags)` * `setRenderHint (self, QPainter.RenderHint?hint, bool?on?=?True)` * `setRenderHints (self, QPainter.RenderHints?hints)` * `setResizeAnchor (self, ViewportAnchor?anchor)` * `setRubberBandSelectionMode (self, Qt.ItemSelectionMode?mode)` * `setScene (self, QGraphicsScene?scene)` * `setSceneRect (self, QRectF?rect)` * `setSceneRect (self, float?ax, float?ay, float?aw, float?ah)` * `setTransform (self, QTransform?matrix, bool?combine?=?False)` * `setTransformationAnchor (self, ViewportAnchor?anchor)` * `setupViewport (self, QWidget?widget)` * `setViewportUpdateMode (self, ViewportUpdateMode?mode)` * `shear (self, float?sh, float?sv)` * `showEvent (self, QShowEvent?event)` * `QSize sizeHint (self)` * `QTransform transform (self)` * `ViewportAnchor transformationAnchor (self)` * `translate (self, float?dx, float?dy)` * `updateScene (self, list-of-QRectF?rects)` * `updateSceneRect (self, QRectF?rect)` * `bool viewportEvent (self, QEvent?event)` * `QTransform viewportTransform (self)` * `ViewportUpdateMode viewportUpdateMode (self)` * `wheelEvent (self, QWheelEvent?event)` * * * ## Detailed Description 該QGraphicsView類提供了一個小工具,用于顯示的內容[QGraphicsScene](qgraphicsscene.html)。 QGraphicsView可視化的內容[QGraphicsScene](qgraphicsscene.html)在一個可滾動的視口。要創建具有幾何項目的場景,看到[QGraphicsScene](qgraphicsscene.html)的文檔。 QGraphicsView是部分[Graphics View Framework](index.htm)。 看到一個場景,你通過構建一個QGraphicsView對象,傳遞你希望顯示到QGraphicsView的構造場景的地址開始。或者,您也可以致電[setScene](qgraphicsview.html#setScene)()來設置場景在稍后一點。你打電話后[show](qwidget.html#show)( ) ,視圖將默認滾動到場景的中心,并顯示在這一點上可見的任何物品。例如: ``` [QGraphicsScene](qgraphicsscene.html) scene; scene.addText("Hello, world!"); QGraphicsView view(&scene); view.show(); ``` 你可以明確地滾動到現場使用滾動條的任何位置,或致電[centerOn](qgraphicsview.html#centerOn)( ) 。通過傳遞點[centerOn](qgraphicsview.html#centerOn)( ) , QGraphicsView將滾動的視口,以確保點集中在視圖中。過載提供滾動到[QGraphicsItem](qgraphicsitem.html)在這種情況下QGraphicsView將看到的項的中心為中心的視圖。如果你想要的是確保一定的區域是可見的, (但不一定為中心),你可以調用[ensureVisible](qgraphicsview.html#ensureVisible)( )來代替。 QGraphicsView可以用來可視化整個場景,或僅部分。可視化領域是默認自動檢測時顯示的視圖第一次(通過調用[QGraphicsScene.itemsBoundingRect](qgraphicsscene.html#itemsBoundingRect)())。要設置可視區域矩形自己,你可以調用[setSceneRect](qgraphicsview.html#sceneRect-prop)( ) 。這將適當調整滾動條“的范圍。請注意,雖然場景支持幾乎無限的大小,滾動條的范圍不會超過一個整數( INT_MIN , INT_MAX )的范圍內。 QGraphicsView通過調用可視化場景[render](qgraphicsview.html#render)( ) 。默認情況下,該項目通過使用常規繪制到視[QPainter](qpainter.html)以及使用默認呈現提示。要更改默認的渲染提示QGraphicsView傳遞到[QPainter](qpainter.html)涂裝項目時,您可以撥打[setRenderHints](qgraphicsview.html#renderHints-prop)( ) 。 默認情況下, QGraphicsView提供了一個正規[QWidget](qwidget.html)為視角構件。您可以通過調用訪問這個widget[viewport](qabstractscrollarea.html#viewport)( ) ,或者你可以通過調用替換它[setViewport](qabstractscrollarea.html#setViewport)( ) 。為了呈現使用OpenGL ,只需調用setViewport (新[QGLWidget](qglwidget.html)) 。 QGraphicsView需要視口部件的所有權。 QGraphicsView支持仿射變換,用[QTransform](qtransform.html)。您可以將矩陣要么傳遞給[setTransform](qgraphicsview.html#setTransform)( ) ,或者您也可以撥打方便的功能之一[rotate](qgraphicsview.html#rotate)( )[scale](qgraphicsview.html#scale)( )[translate](qgraphicsview.html#translate)()或[shear](qgraphicsview.html#shear)( ) 。最常見2轉換的比例,這是用于實現縮放和旋轉。 QGraphicsView保持在轉換過程中的固定視圖的中心。因為現場校準( setAligment ( ) )的,翻譯的看法不會有視覺沖擊力。 您可以使用鼠標和鍵盤對場景中的項目進行互動。 QGraphicsView轉化鼠標和鍵盤事件到_scene_事件(事件繼承[QGraphicsSceneEvent](qgraphicssceneevent.html), ) ,并將其轉發到可視化的場景。在最后,它是處理該事件并發生反應,它們的個別項目。例如,如果你點擊一個可選項目,該項目將通常讓現場知道它已被選中,它也將重繪自身來顯示一個選擇矩形。 Similiary ,如果您單擊并拖動鼠標來移動一個可移動的項目,它是處理鼠標移動和移動自己的項目。項目的互動是默認啟用的,你可以通過調用它切換[setInteractive](qgraphicsview.html#interactive-prop)( ) 。 您也可以提供自己的自定義場景的交互,通過創建QGraphicsView的一個子類,并重新實現鼠標和鍵盤事件處理程序。為了簡化你如何與視圖中的項編程交互, QGraphicsView提供了映射函數[mapToScene](qgraphicsview.html#mapToScene)()和[mapFromScene](qgraphicsview.html#mapFromScene)() ,并且項目的存取[items](qgraphicsview.html#items)()和[itemAt](qgraphicsview.html#itemAt)( ) 。這些功能允許你映射視圖坐標和場景之間的坐標點,矩形,多邊形和路徑,并找到使用視圖坐標在現場的項目。 ![](https://img.kancloud.cn/48/1c/481c369424479855bb36018f944ce934_354x208.png) * * * ## Type Documentation ``` QGraphicsView.CacheModeFlag ``` 這個枚舉說明您可以對設置的標志[QGraphicsView](qgraphicsview.html)的緩存模式。 | Constant | Value | Description | | --- | --- | --- | | `QGraphicsView.CacheNone` | `0x0` | 所有的畫是直接完成到視口。 | | `QGraphicsView.CacheBackground` | `0x1` | 后臺緩存。這會影響自定義的背景,并基于該背景[backgroundBrush](qgraphicsview.html#backgroundBrush-prop)屬性。當這個標志被啟用,[QGraphicsView](qgraphicsview.html)將分配一個像素圖與視口的全尺寸。 | CacheMode參數類型是一個typedef為[QFlags](index.htm)\u003cCacheModeFlag\u003e 。它存儲CacheModeFlag值的或組合。 **See also** [cacheMode](qgraphicsview.html#cacheMode-prop)。 ``` QGraphicsView.DragMode ``` 按住并拖動鼠標移到視口時,此枚舉描述的默認操作的視圖。 | Constant | Value | Description | | --- | --- | --- | | `QGraphicsView.NoDrag` | `0` | 什么也沒有發生;鼠標事件被忽略。 | | `QGraphicsView.ScrollHandDrag` | `1` | 光標變為手形指針,和周圍拖動鼠標將滾動scrolbars 。此模式無論是在[interactive](qgraphicsview.html#interactive-prop)和非交互模式。 | | `QGraphicsView.RubberBandDrag` | `2` | 橡膠帶將出現。拖動鼠標,將設置橡皮筋的幾何形狀,以及所涵蓋的橡皮筋??會選擇所有項目。這種模式對于非交互式的看法禁用。 | **See also** [dragMode](qgraphicsview.html#dragMode-prop)和[QGraphicsScene.setSelectionArea](qgraphicsscene.html#setSelectionArea)( ) 。 ``` QGraphicsView.OptimizationFlag ``` 這個枚舉說明標志,您可以啟用,以提高渲染性能[QGraphicsView](qgraphicsview.html)。默認情況下,沒有這些標志的設置。請注意,設置一個標志,通常對一個副作用,這種作用可以噴漆設備和平臺之間變化。 | Constant | Value | Description | | --- | --- | --- | | `QGraphicsView.DontClipPainter` | `0x1` | 此值已過時,沒有任何效果。 | | `QGraphicsView.DontSavePainterState` | `0x2` | 當渲染,[QGraphicsView](qgraphicsview.html)保護畫家狀態(見[QPainter.save](qpainter.html#save)( ) )繪制背景或前景時,并呈現每個項目時。這可以讓你離開畫家在改變狀態(例如,你可以調用[QPainter.setPen](qpainter.html#setPen)()或[QPainter.setBrush](qpainter.html#setBrush)( )無涂裝后恢復狀態) 。但是,如果項目持續做恢復狀態,您應該啟用這個標志,以防止[QGraphicsView](qgraphicsview.html)從做同樣的。 | | `QGraphicsView.DontAdjustForAntialiasing` | `0x4` | 禁用[QGraphicsView](qgraphicsview.html)的抗鋸齒自動調整曝光過的區域。該渲染的抗鋸齒邊界線的項目[QGraphicsItem.boundingRect](qgraphicsitem.html#boundingRect)( )可以結束了渲染線的部分外。為了防止渲染文物,[QGraphicsView](qgraphicsview.html)通過在各個方向2像素展開所有暴露區域。如果您啟用這個標志,[QGraphicsView](qgraphicsview.html)將不再執行這些調整,最大限度地減少需要重繪,從而提高了性能方面。一個常見的副作用是那些繪制抗鋸齒項目能留下痕跡的繪畫背后的身影,因為他們所感動。 | | `QGraphicsView.IndirectPainting` | `0x8` | 由于Qt的4.6 ,恢復舊的繪畫算法調用[QGraphicsView.drawItems](index.htm#drawItems)()和[QGraphicsScene.drawItems](index.htm#drawItems)( ) 。要只是為了與舊代碼的兼容性使用。 | 這個枚舉被引入或修改的Qt 4.3 。 該OptimizationFlags類型是一個typedef為[QFlags](index.htm)\u003cOptimizationFlag\u003e 。它存儲OptimizationFlag值的或組合。 ``` QGraphicsView.ViewportAnchor ``` 此枚舉描述了可能的錨[QGraphicsView](qgraphicsview.html)當用戶改變視圖或視圖時轉化可以使用。 | Constant | Value | Description | | --- | --- | --- | | `QGraphicsView.NoAnchor` | `0` | 無錨,即認為離開現場的位置不變。 | | `QGraphicsView.AnchorViewCenter` | `1` | 在視圖的中心現場點作為支撐點。 | | `QGraphicsView.AnchorUnderMouse` | `2` | 鼠標下的點作為支撐點。 | **See also** [resizeAnchor](qgraphicsview.html#resizeAnchor-prop)和[transformationAnchor](qgraphicsview.html#transformationAnchor-prop)。 ``` QGraphicsView.ViewportUpdateMode ``` 這個枚舉說明如何[QGraphicsView](qgraphicsview.html)更新其視口時的情景內容變更或暴露。 | Constant | Value | Description | | --- | --- | --- | | `QGraphicsView.FullViewportUpdate` | `0` | 當場景中任何可見部分改變或再次暴露,[QGraphicsView](qgraphicsview.html)將更新整個視口。這種方法是最快的時候[QGraphicsView](qgraphicsview.html)花費更多的時間搞清楚什么畫會比花繪圖(例如,當非常多的小項目,多次更新) 。這是優選的更新模式對視口不支持部分更新,如[QGLWidget](qglwidget.html),為此,需要禁用滾動優化的視口。 | | `QGraphicsView.MinimalViewportUpdate` | `1` | [QGraphicsView](qgraphicsview.html)將確定的最小視口區域需要重繪,盡量減少避免那些沒有改變的區域重繪圖紙花費的時間。這是[QGraphicsView](qgraphicsview.html)的默認模式。雖然這種方法提供了最佳的性能在一般情況下,如果有在現場許多小可見的變化,[QGraphicsView](qgraphicsview.html)最終可能會花費更多的時間尋找最小的方法比將斥資繪圖。 | | `QGraphicsView.SmartViewportUpdate` | `2` | [QGraphicsView](qgraphicsview.html)將嘗試通過分析那些需要重繪的區域找到一個最佳的更新模式。 | | `QGraphicsView.BoundingRectViewportUpdate` | `4` | 在視口中的所有更改的邊框將被重新繪制。這種模式具有的優點是[QGraphicsView](qgraphicsview.html)搜索只有一個變化區域,最大限度地減少花費的時間確定什么需要重繪。它的缺點是沒有變化的區域也需要被重新繪制。 | | `QGraphicsView.NoViewportUpdate` | `3` | [QGraphicsView](qgraphicsview.html)永遠不會更新其視口時的情景變化,用戶有望控制所有更新。此模式禁用所有(可能慢)項的可見性測試[QGraphicsView](qgraphicsview.html)以及適合于場景,要么需要固定幀速率,或在視口外部,否則更新。 | 這個枚舉被引入或修改的Qt 4.3 。 **See also** [viewportUpdateMode](qgraphicsview.html#viewportUpdateMode-prop)。 * * * ## Method Documentation ``` QGraphicsView.__init__ (self, QWidget?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個[QGraphicsView](qgraphicsview.html)。_parent_被傳遞給[QWidget](qwidget.html)的構造。 ``` QGraphicsView.__init__ (self, QGraphicsScene?scene, QWidget?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個[QGraphicsView](qgraphicsview.html)并設置可視化場景_scene_。_parent_被傳遞給[QWidget](qwidget.html)的構造。 ``` Qt.Alignment QGraphicsView.alignment (self) ``` [](index.htm) ``` QBrush QGraphicsView.backgroundBrush (self) ``` [](qbrush.html) ``` CacheMode QGraphicsView.cacheMode (self) ``` [ ``` QGraphicsView.centerOn (self, QPointF?pos) ``` 滾動視口的內容,以確保現場協調_pos_,集中在視圖中。 因為_pos_是一個浮點坐標,滾動條上的整數坐標進行操作,對中只是一個近似值。 **Note:**如果該項目已接近或外部的邊界,這將是可見的視圖,但不集中。 ](index.htm) [**See also**](index.htm) [ensureVisible](qgraphicsview.html#ensureVisible)( ) 。 ``` QGraphicsView.centerOn (self, QGraphicsItem?item) ``` 這是一個重載函數。 此功能提供了方便。這相當于調用centerOn ([QPointF](qpointf.html)(_x_,_y_))。 ``` QGraphicsView.centerOn (self, float?ax, float?ay) ``` 這是一個重載函數。 滾動視口的內容,以確保_item_集中在視圖中。 **See also** [ensureVisible](qgraphicsview.html#ensureVisible)( ) 。 ``` QGraphicsView.contextMenuEvent (self, QContextMenuEvent?event) ``` 從重新實現[QWidget.contextMenuEvent](qwidget.html#contextMenuEvent)( ) 。 ``` QGraphicsView.dragEnterEvent (self, QDragEnterEvent?event) ``` 從重新實現[QWidget.dragEnterEvent](qwidget.html#dragEnterEvent)( ) 。 ``` QGraphicsView.dragLeaveEvent (self, QDragLeaveEvent?event) ``` 從重新實現[QWidget.dragLeaveEvent](qwidget.html#dragLeaveEvent)( ) 。 ``` DragMode QGraphicsView.dragMode (self) ``` [ ``` QGraphicsView.dragMoveEvent (self, QDragMoveEvent?event) ``` ](qgraphicsview.html#DragMode-enum) [從重新實現](qgraphicsview.html#DragMode-enum)[QWidget.dragMoveEvent](qwidget.html#dragMoveEvent)( ) 。 ``` QGraphicsView.drawBackground (self, QPainter?painter, QRectF?rect) ``` 繪制的場景采用背景_painter_之前,任何產品和前景繪制。重新實現這個函數提供一個自定義的背景這一觀點。 如果你想要的是定義一個顏色,紋理或漸變的背景,你可以調用[setBackgroundBrush](qgraphicsview.html#backgroundBrush-prop)( )來代替。 所有的繪制是在做_scene_坐標。_rect_是暴露的矩形。 默認實現罷了_rect_使用視圖的[backgroundBrush](qgraphicsview.html#backgroundBrush-prop)。如果沒有這樣的筆刷定義(默認) ,場景的drawBackground ( )函數被調用來代替。 **See also** [drawForeground](qgraphicsview.html#drawForeground)()和[QGraphicsScene.drawBackground](qgraphicsscene.html#drawBackground)( ) 。 ``` QGraphicsView.drawForeground (self, QPainter?painter, QRectF?rect) ``` 繪制場景的使用前景_painter_,背景和所有項目后得出。重新實現這個函數提供一個自定義前景的這一觀點。 如果你想要的是定義一個顏色,紋理或漸變的前景,你可以調用[setForegroundBrush](qgraphicsview.html#foregroundBrush-prop)( )來代替。 所有的繪制是在做_scene_坐標。_rect_是暴露的矩形。 默認實現罷了_rect_使用視圖的[foregroundBrush](qgraphicsview.html#foregroundBrush-prop)。如果沒有這樣的筆刷定義(默認) ,場景的drawForeground ( )函數被調用來代替。 **See also** [drawBackground](qgraphicsview.html#drawBackground)()和[QGraphicsScene.drawForeground](qgraphicsscene.html#drawForeground)( ) 。 ``` QGraphicsView.drawItems (self, QPainter?painter, list-of-QGraphicsItem?items, list-of-QStyleOptionGraphicsItem?options) ``` ``` QGraphicsView.dropEvent (self, QDropEvent?event) ``` 從重新實現[QWidget.dropEvent](qwidget.html#dropEvent)( ) 。 ``` QGraphicsView.ensureVisible (self, QRectF?rect, int?xMargin?=?50, int?yMargin?=?50) ``` 視口的滾動內容,使現場的矩形_rect_可見,與以像素為單位指定頁邊距_xmargin_和_ymargin_。如果指定的矩形無法達成,內容滾動到最近的有效位置。兩個邊距的默認值是50個像素。 **See also** [centerOn](qgraphicsview.html#centerOn)( ) 。 ``` QGraphicsView.ensureVisible (self, QGraphicsItem?item, int?xMargin?=?50, int?yMargin?=?50) ``` 這是一個重載函數。 此功能提供了方便。這相當于調用ensureVisible ([QRectF](qrectf.html)(_x_,_y_,_w_,_h_) ,_xmargin_,_ymargin_) 。 ``` QGraphicsView.ensureVisible (self, float?x, float?y, float?w, float?h, int?xMargin?=?50, int?yMargin?=?50) ``` 這是一個重載函數。 滾動視口的內容,使項目的中心_item_可見,與以像素為單位指定頁邊距_xmargin_和_ymargin_。如果指定的點不能達到,其內容被滾動到最近的有效位置。兩個邊距的默認值是50個像素。 **See also** [centerOn](qgraphicsview.html#centerOn)( ) 。 ``` bool QGraphicsView.event (self, QEvent?event) ``` 從重新實現[QObject.event](qobject.html#event)( ) 。 ``` QGraphicsView.fitInView (self, QRectF?rect, Qt.AspectRatioMode?mode?=?Qt.IgnoreAspectRatio) ``` 縮放視圖矩陣和滾動滾動條,以確保現場的矩形_rect_適合視口內。_rect_必須是現場矩形內部,否則fitInView ( )不能保證整個RECT是可見的。 此功能保持視圖的旋轉,平移,或剪切。該視圖是根據縮放_aspectRatioMode_。_rect_將集中在視圖中,如果它不緊緊貼合。 這是常見的從一個重新實現內部調用fitInView ( )[resizeEvent](qgraphicsview.html#resizeEvent)( ) ,以確保整個場景或場景的部分,自動縮放以適應視口的新大小作為視圖調整大小。不過請注意,從里面調用fitInView ( )[resizeEvent](qgraphicsview.html#resizeEvent)( )可能會導致不必要的調整大小遞歸,如果新的變革切換滾動條的自動狀態。您可以切換滾動條政策,以常開或常關閉,以防止這種情況(見[horizontalScrollBarPolicy](qabstractscrollarea.html#horizontalScrollBarPolicy-prop)()和[verticalScrollBarPolicy](qabstractscrollarea.html#verticalScrollBarPolicy-prop)())。 If _rect_是空的,或者如果視口太小,這個函數不會做任何事。 **See also** [setTransform](qgraphicsview.html#setTransform)( )[ensureVisible](qgraphicsview.html#ensureVisible)()和[centerOn](qgraphicsview.html#centerOn)( ) 。 ``` QGraphicsView.fitInView (self, QGraphicsItem?item, Qt.AspectRatioMode?mode?=?Qt.IgnoreAspectRatio) ``` 這是一個重載函數。 這個方便的功能等同于調用fitInView ([QRectF](qrectf.html)(_x_,_y_,_w_,_h_) ,_aspectRatioMode_) 。 **See also** [ensureVisible](qgraphicsview.html#ensureVisible)()和[centerOn](qgraphicsview.html#centerOn)( ) 。 ``` QGraphicsView.fitInView (self, float?x, float?y, float?w, float?h, Qt.AspectRatioMode?mode?=?Qt.IgnoreAspectRatio) ``` 這是一個重載函數。 確保_item_緊密配合在視圖內,根據縮放視圖_aspectRatioMode_。 **See also** [ensureVisible](qgraphicsview.html#ensureVisible)()和[centerOn](qgraphicsview.html#centerOn)( ) 。 ``` QGraphicsView.focusInEvent (self, QFocusEvent?event) ``` 從重新實現[QWidget.focusInEvent](qwidget.html#focusInEvent)( ) 。 ``` bool QGraphicsView.focusNextPrevChild (self, bool?next) ``` 從重新實現[QWidget.focusNextPrevChild](qwidget.html#focusNextPrevChild)( ) 。 ``` QGraphicsView.focusOutEvent (self, QFocusEvent?event) ``` 從重新實現[QWidget.focusOutEvent](qwidget.html#focusOutEvent)( ) 。 ``` QBrush QGraphicsView.foregroundBrush (self) ``` [ ``` QGraphicsView.inputMethodEvent (self, QInputMethodEvent?event) ``` ](qbrush.html) [從重新實現](qbrush.html)[QWidget.inputMethodEvent](qwidget.html#inputMethodEvent)( ) 。 ``` QVariant QGraphicsView.inputMethodQuery (self, Qt.InputMethodQuery?query) ``` 從重新實現[QWidget.inputMethodQuery](qwidget.html#inputMethodQuery)( ) 。 ``` QGraphicsView.invalidateScene (self, QRectF?rect?=?QRectF(), QGraphicsScene.SceneLayers?layers?=?QGraphicsScene.AllLayers) ``` 這種方法也是一個Qt槽與C + +的簽名`void invalidateScene(const QRectF& = QRectF(),QGraphicsScene::SceneLayers = QGraphicsScene.AllLayers)`。 廢止及時間表重繪_layers_內_rect_。_rect_在場景坐標。對于任何緩存的內容_layers_內_rect_無條件失效并重新繪制。 你可以調用這個函數來通知[QGraphicsView](qgraphicsview.html)的改變,背景或場景的前景。它通常用于場景與基于區塊的背景來通知改變時[QGraphicsView](qgraphicsview.html)啟用了后臺緩存。 需要注意的是[QGraphicsView](qgraphicsview.html)目前支持后臺緩存只(見[QGraphicsView.CacheBackground](qgraphicsview.html#CacheModeFlag-enum)) 。此功能相當于調用[update](qwidget.html#update)( )如有層,但[QGraphicsScene.BackgroundLayer](qgraphicsscene.html#SceneLayer-enum)被傳遞。 **See also** [QGraphicsScene.invalidate](qgraphicsscene.html#invalidate)()和[update](qwidget.html#update)( ) 。 ``` bool QGraphicsView.isInteractive (self) ``` ``` bool QGraphicsView.isTransformed (self) ``` 返回True如果視圖被轉換(即,非恒等變換已被分配,或滾動條進行調整) 。 此功能被引入Qt的4.6 。 **See also** [setTransform](qgraphicsview.html#setTransform)( )[horizontalScrollBar](qabstractscrollarea.html#horizontalScrollBar)()和[verticalScrollBar](qabstractscrollarea.html#verticalScrollBar)( ) 。 ``` QGraphicsItem QGraphicsView.itemAt (self, QPoint?pos) ``` [ 返回在位置的項目_pos_,這是在視口坐標。如果有多個項目在這個位置,這個函數返回的最上方項目。 例如: ](qgraphicsitem.html) ``` void CustomView.mousePressEvent(QMouseEvent *event) { if ([QGraphicsItem](qgraphicsitem.html) *item = itemAt(event->pos())) { qDebug() << "You clicked on item" << item; } else { qDebug() << "You didn't click on an item."; } } ``` **See also** [items](qgraphicsview.html#items)()和[Sorting](qgraphicsitem.html#sorting)。 ``` QGraphicsItem QGraphicsView.itemAt (self, int?ax, int?ay) ``` [ 這是一個重載函數。 ](qgraphicsitem.html) [此功能提供了方便。這相當于調用itemAt (](qgraphicsitem.html)[QPoint](qpoint.html)(_x_,_y_))。 ``` list-of-QGraphicsItem QGraphicsView.items (self) ``` 返回相關聯的場景中的所有項目,按降序堆疊順序(即,在返回列表中的第一項是最上面的項目)的列表。 **See also** [QGraphicsScene.items](qgraphicsscene.html#items)()和[Sorting](qgraphicsitem.html#sorting)。 ``` list-of-QGraphicsItem QGraphicsView.items (self, QPoint?pos) ``` 返回所有項目的列表的位置_pos_在視圖中。該項目按遞減順序堆疊(即,在列表中的第一個項目是最上面的項目,最后項目是最下面的項目) 。_pos_在視口中坐標。 這個功能是最常用的內鼠標事件處理程序調用子類中的[QGraphicsView](qgraphicsview.html)。_pos_在未轉化的視口坐標,就像[QMouseEvent.pos](qmouseevent.html#pos)( ) 。 ``` void CustomView.mousePressEvent([QMouseEvent](qmouseevent.html) *event) { qDebug() << "There are" << items(event->pos()).size() << "items at position" << mapToScene(event->pos()); } ``` **See also** [QGraphicsScene.items](qgraphicsscene.html#items)()和[Sorting](qgraphicsitem.html#sorting)。 ``` list-of-QGraphicsItem QGraphicsView.items (self, int?ax, int?ay) ``` 此功能提供了方便。這相當于調用項目([QPoint](qpoint.html)(_x_,_y_))。 ``` list-of-QGraphicsItem QGraphicsView.items (self, int?x, int?y, int?w, int?h, Qt.ItemSelectionMode?mode?=?Qt.IntersectsItemShape) ``` 這個方便的功能等同于調用項目([QRectF](qrectf.html)(_x_,_y_,_w_,_h_) ,_mode_) 。 此功能被引入Qt的4.3 。 ``` list-of-QGraphicsItem QGraphicsView.items (self, QRect?rect, Qt.ItemSelectionMode?mode?=?Qt.IntersectsItemShape) ``` 這是一個重載函數。 返回所有的,取決于項目的列表_mode_,是由兩種或包含與相交_rect_。_rect_在視口中坐標。 為默認值_mode_ is [Qt.IntersectsItemShape](qt.html#ItemSelectionMode-enum);所有項目的確切形狀相交或包含由_rect_返回。 該項目按降序堆疊順序(即,在返回列表中的第一項是最上面的項目) 。 **See also** [itemAt](qgraphicsview.html#itemAt)( )[items](qgraphicsview.html#items)( )[mapToScene](qgraphicsview.html#mapToScene)()和[Sorting](qgraphicsitem.html#sorting)。 ``` list-of-QGraphicsItem QGraphicsView.items (self, QPolygon?polygon, Qt.ItemSelectionMode?mode?=?Qt.IntersectsItemShape) ``` 這是一個重載函數。 返回所有的,取決于項目的列表_mode_,是由兩種或包含與相交_polygon_。_polygon_在視口中坐標。 為默認值_mode_ is [Qt.IntersectsItemShape](qt.html#ItemSelectionMode-enum);所有項目的確切形狀相交或包含由_polygon_返回。 該項目是由遞減堆棧順序(即,在返回列表中的第一項是最上面的項目)進行分類。 **See also** [itemAt](qgraphicsview.html#itemAt)( )[items](qgraphicsview.html#items)( )[mapToScene](qgraphicsview.html#mapToScene)()和[Sorting](qgraphicsitem.html#sorting)。 ``` list-of-QGraphicsItem QGraphicsView.items (self, QPainterPath?path, Qt.ItemSelectionMode?mode?=?Qt.IntersectsItemShape) ``` 這是一個重載函數。 返回所有的,取決于項目的列表_mode_,是由兩種或包含與相交_path_。_path_在視口中坐標。 為默認值_mode_ is [Qt.IntersectsItemShape](qt.html#ItemSelectionMode-enum);所有項目的確切形狀相交或包含由_path_返回。 **See also** [itemAt](qgraphicsview.html#itemAt)( )[items](qgraphicsview.html#items)( )[mapToScene](qgraphicsview.html#mapToScene)()和[Sorting](qgraphicsitem.html#sorting)。 ``` QGraphicsView.keyPressEvent (self, QKeyEvent?event) ``` 從重新實現[QWidget.keyPressEvent](qwidget.html#keyPressEvent)( ) 。 ``` QGraphicsView.keyReleaseEvent (self, QKeyEvent?event) ``` 從重新實現[QWidget.keyReleaseEvent](qwidget.html#keyReleaseEvent)( ) 。 ``` QPoint QGraphicsView.mapFromScene (self, QPointF?point) ``` [ 返回現場協調_point_視口坐標。 ](qpoint.html) [**See also**](qpoint.html) [mapToScene](qgraphicsview.html#mapToScene)( ) 。 ``` QPolygon QGraphicsView.mapFromScene (self, QRectF?rect) ``` [ 返回矩形現場_rect_一個視口坐標的多邊形。 ](qpolygon.html) [**See also**](qpolygon.html) [mapToScene](qgraphicsview.html#mapToScene)( ) 。 ``` QPolygon QGraphicsView.mapFromScene (self, QPolygonF?polygon) ``` [ 返回現場多邊形的坐標_polygon_一個視口坐標的多邊形。 ](qpolygon.html) [**See also**](qpolygon.html) [mapToScene](qgraphicsview.html#mapToScene)( ) 。 ``` QPainterPath QGraphicsView.mapFromScene (self, QPainterPath?path) ``` [ 返回現場協調畫家路徑_path_一個視口坐標畫家路徑。 ](qpainterpath.html) [**See also**](qpainterpath.html) [mapToScene](qgraphicsview.html#mapToScene)( ) 。 ``` QPoint QGraphicsView.mapFromScene (self, float?ax, float?ay) ``` [](qpoint.html) [此功能提供了方便。這相當于調用mapFromScene (](qpoint.html)[QPointF](qpointf.html)(_x_,_y_))。 ``` QPolygon QGraphicsView.mapFromScene (self, float?ax, float?ay, float?w, float?h) ``` [](qpolygon.html) [此功能提供了方便。這相當于調用mapFromScene (](qpolygon.html)[QRectF](qrectf.html)(_x_,_y_,_w_,_h_))。 ``` QPointF QGraphicsView.mapToScene (self, QPoint?point) ``` [ 返回視口坐標_point_映射到場景坐標。 ](qpointf.html) [注意:它可以是有用的映射所復蓋的像素在整個矩形_point_代替點本身。要做到這一點,你可以調用mapToScene (](qpointf.html)[QRect](qrect.html)(_point_,[QSize](qsize.html)( 2,2) ))。 **See also** [mapFromScene](qgraphicsview.html#mapFromScene)( ) 。 ``` QPolygonF QGraphicsView.mapToScene (self, QRect?rect) ``` [ 返回視口矩形_rect_映射到一個場景坐標的多邊形。 ](qpolygonf.html) [**See also**](qpolygonf.html) [mapFromScene](qgraphicsview.html#mapFromScene)( ) 。 ``` QPolygonF QGraphicsView.mapToScene (self, QPolygon?polygon) ``` [ 返回多邊形視口_polygon_映射到一個場景坐標的多邊形。 ](qpolygonf.html) [**See also**](qpolygonf.html) [mapFromScene](qgraphicsview.html#mapFromScene)( ) 。 ``` QPainterPath QGraphicsView.mapToScene (self, QPainterPath?path) ``` [ 返回視口畫家路徑_path_映射到一個場景的坐標畫家路徑。 ](qpainterpath.html) [**See also**](qpainterpath.html) [mapFromScene](qgraphicsview.html#mapFromScene)( ) 。 ``` QPointF QGraphicsView.mapToScene (self, int?ax, int?ay) ``` [](qpointf.html) [此功能提供了方便。這相當于調用mapToScene (](qpointf.html)[QPoint](qpoint.html)(_x_,_y_))。 ``` QPolygonF QGraphicsView.mapToScene (self, int?ax, int?ay, int?w, int?h) ``` [](qpolygonf.html) [此功能提供了方便。這相當于調用mapToScene (](qpolygonf.html)[QRect](qrect.html)(_x_,_y_,_w_,_h_))。 ``` QMatrix QGraphicsView.matrix (self) ``` [ 返回該視圖的當前轉換矩陣。如果沒有當前變換設置,返回單位矩陣。 ](qmatrix.html) [**See also**](qmatrix.html) [setMatrix](qgraphicsview.html#setMatrix)( )[transform](qgraphicsview.html#transform)( )[rotate](qgraphicsview.html#rotate)( )[scale](qgraphicsview.html#scale)( )[shear](qgraphicsview.html#shear)()和[translate](qgraphicsview.html#translate)( ) 。 ``` QGraphicsView.mouseDoubleClickEvent (self, QMouseEvent?event) ``` 從重新實現[QWidget.mouseDoubleClickEvent](qwidget.html#mouseDoubleClickEvent)( ) 。 ``` QGraphicsView.mouseMoveEvent (self, QMouseEvent?event) ``` 從重新實現[QWidget.mouseMoveEvent](qwidget.html#mouseMoveEvent)( ) 。 ``` QGraphicsView.mousePressEvent (self, QMouseEvent?event) ``` 從重新實現[QWidget.mousePressEvent](qwidget.html#mousePressEvent)( ) 。 ``` QGraphicsView.mouseReleaseEvent (self, QMouseEvent?event) ``` 從重新實現[QWidget.mouseReleaseEvent](qwidget.html#mouseReleaseEvent)( ) 。 ``` OptimizationFlags QGraphicsView.optimizationFlags (self) ``` [ ``` QGraphicsView.paintEvent (self, QPaintEvent?event) ``` ](index.htm) [從重新實現](index.htm)[QWidget.paintEvent](qwidget.html#paintEvent)( ) 。 ``` QGraphicsView.render (self, QPainter?painter, QRectF?target?=?QRectF(), QRect?source?=?QRect(), Qt.AspectRatioMode?mode?=?Qt.KeepAspectRatio) ``` 呈現_source_矩形,這是在視圖坐標,從場景到_target_,這是在繪制設備坐標,使用_painter_。此功能可用于捕獲視圖的內容到一個繪圖設備,如一個有用的[QImage](qimage.html)(例如,采取截圖) ,或用于印刷[QPrinter](qprinter.html)。例如: ``` [QGraphicsScene](qgraphicsscene.html) scene; scene.addItem(... ... [QGraphicsView](qgraphicsview.html) view(&scene); view.show(); ... [QPrinter](qprinter.html) printer([QPrinter](qprinter.html).HighResolution); printer.setPageSize([QPrinter](qprinter.html).A4); [QPainter](qpainter.html) painter(&printer); // print, fitting the viewport contents into a full page view.render(&painter); // print the upper half of the viewport into the lower. // half of the page. [QRect](qrect.html) viewport = view.viewport()->rect(); view.render(&painter, [QRectF](qrectf.html)(0, printer.height() / 2, printer.width(), printer.height() / 2), viewport.adjusted(0, 0, 0, -viewport.height() / 2)); ``` If _source_是一個空矩形,該函數將使用[viewport](qabstractscrollarea.html#viewport)() - \u003e[rect](qwidget.html#rect-prop)()來確定要畫什么。如果_target_是一個空矩形,的全尺寸_painter_的涂料設備(例如,對于一個[QPrinter](qprinter.html),頁大小)將被使用。 矩形內容源將根據待轉化_aspectRatioMode_以適應目標矩形。默認情況下,縱橫比蒙了,_source_縮放以適合_target_。 **See also** [QGraphicsScene.render](qgraphicsscene.html#render)( ) 。 ``` QPainter.RenderHints QGraphicsView.renderHints (self) ``` [ ``` QGraphicsView.resetCachedContent (self) ``` ](index.htm) [重置任何緩存內容。調用此函數將清除](index.htm)[QGraphicsView](qgraphicsview.html)的緩存。如果當前緩存模式[CacheNone](qgraphicsview.html#CacheModeFlag-enum),這個函數不執行任何操作。 此功能自動為您調用的時候,[backgroundBrush](qgraphicsview.html#backgroundBrush-prop) or [QGraphicsScene.backgroundBrush](qgraphicsscene.html#backgroundBrush-prop)性質發生變化,你只需要調用這個函數,如果你已經重新實現[QGraphicsScene.drawBackground](qgraphicsscene.html#drawBackground)()或[QGraphicsView.drawBackground](qgraphicsview.html#drawBackground)()來繪制一個自定義背景,以及需要觸發一個完全重繪。 **See also** [cacheMode](qgraphicsview.html#cacheMode-prop)( ) 。 ``` QGraphicsView.resetMatrix (self) ``` 重置視圖變換矩陣為單位矩陣。 **See also** [resetTransform](qgraphicsview.html#resetTransform)( ) 。 ``` QGraphicsView.resetTransform (self) ``` 重置視圖轉換為單位矩陣。 **See also** [transform](qgraphicsview.html#transform)()和[setTransform](qgraphicsview.html#setTransform)( ) 。 ``` ViewportAnchor QGraphicsView.resizeAnchor (self) ``` [ ``` QGraphicsView.resizeEvent (self, QResizeEvent?event) ``` ](qgraphicsview.html#ViewportAnchor-enum) [從重新實現](qgraphicsview.html#ViewportAnchor-enum)[QWidget.resizeEvent](qwidget.html#resizeEvent)( ) 。 ``` QGraphicsView.rotate (self, float?angle) ``` 旋轉當前視圖轉換_angle_度順時針旋轉。 **See also** [setTransform](qgraphicsview.html#setTransform)( )[transform](qgraphicsview.html#transform)( )[scale](qgraphicsview.html#scale)( )[shear](qgraphicsview.html#shear)()和[translate](qgraphicsview.html#translate)( ) 。 ``` Qt.ItemSelectionMode QGraphicsView.rubberBandSelectionMode (self) ``` [ ``` QGraphicsView.scale (self, float?sx, float?sy) ``` 由(縮放當前視圖轉換_sx_,_sy_) 。 ](qt.html#ItemSelectionMode-enum) [**See also**](qt.html#ItemSelectionMode-enum) [setTransform](qgraphicsview.html#setTransform)( )[transform](qgraphicsview.html#transform)( )[rotate](qgraphicsview.html#rotate)( )[shear](qgraphicsview.html#shear)()和[translate](qgraphicsview.html#translate)( ) 。 ``` QGraphicsScene QGraphicsView.scene (self) ``` [ 返回一個指針,在視圖中當前可視化的場景。如果沒有現場正在顯現,則返回0 。 ](qgraphicsscene.html) [**See also**](qgraphicsscene.html) [setScene](qgraphicsview.html#setScene)(). ``` QRectF QGraphicsView.sceneRect (self) ``` [ ``` QGraphicsView.scrollContentsBy (self, int?dx, int?dy) ``` ](qrectf.html) [從重新實現](qrectf.html)[QAbstractScrollArea.scrollContentsBy](qabstractscrollarea.html#scrollContentsBy)( ) 。 ``` QGraphicsView.setAlignment (self, Qt.Alignment?alignment) ``` ``` QGraphicsView.setBackgroundBrush (self, QBrush?brush) ``` ``` QGraphicsView.setCacheMode (self, CacheMode?mode) ``` ``` QGraphicsView.setDragMode (self, DragMode?mode) ``` ``` QGraphicsView.setForegroundBrush (self, QBrush?brush) ``` ``` QGraphicsView.setInteractive (self, bool?allowed) ``` ``` QGraphicsView.setMatrix (self, QMatrix?matrix, bool?combine?=?False) ``` 設置視圖的當前轉換矩陣_matrix_。 If _combine_是真的,那么_matrix_是結合當前矩陣,否則_matrix_ _replaces_當前矩陣。_combine_默認為False 。 變換矩陣tranforms現場成視圖坐標。使用默認的轉變,由單位矩陣提供,在視圖中一個像素代表一個單位中的場景(例如,一個10×10的矩形項目使用視圖10X10像素繪制) 。如果一個2x2矩陣縮放應用,該場景將在1:2繪制(例如,一個10×10的矩形產品,然后使用視圖20×20像素繪制) 。 例如: ``` [QGraphicsScene](qgraphicsscene.html) scene; scene.addText("GraphicsView rotated clockwise"); [QGraphicsView](qgraphicsview.html) view(&scene); view.rotate(90); // the text is rendered with a 90 degree clockwise rotation view.show(); ``` 為了簡化互為作用與使用轉換視圖中的項目,[QGraphicsView](qgraphicsview.html)提供mapTo ...和mapFrom ...功能,可以現場和視圖坐標之間的轉換。例如,你可以調用[mapToScene](qgraphicsview.html#mapToScene)( )映射視圖坐標為浮點場景坐標,或[mapFromScene](qgraphicsview.html#mapFromScene)()從浮點數的場景地圖坐標,查看坐標。 **See also** [matrix](qgraphicsview.html#matrix)( )[setTransform](qgraphicsview.html#setTransform)( )[rotate](qgraphicsview.html#rotate)( )[scale](qgraphicsview.html#scale)( )[shear](qgraphicsview.html#shear)()和[translate](qgraphicsview.html#translate)( ) 。 ``` QGraphicsView.setOptimizationFlag (self, OptimizationFlag?flag, bool?enabled?=?True) ``` Enables _flag_如果_enabled_為True,否則禁用_flag_。 **See also** [optimizationFlags](qgraphicsview.html#optimizationFlags-prop)。 ``` QGraphicsView.setOptimizationFlags (self, OptimizationFlags?flags) ``` ``` QGraphicsView.setRenderHint (self, QPainter.RenderHint?hint, bool?on?=?True) ``` If _enabled_是真的,渲染提示_hint_被啟用,否則它被禁用。 **See also** [renderHints](qgraphicsview.html#renderHints-prop)。 ``` QGraphicsView.setRenderHints (self, QPainter.RenderHints?hints) ``` ``` QGraphicsView.setResizeAnchor (self, ViewportAnchor?anchor) ``` ``` QGraphicsView.setRubberBandSelectionMode (self, Qt.ItemSelectionMode?mode) ``` ``` QGraphicsView.setScene (self, QGraphicsScene?scene) ``` 設置當前場景_scene_。如果_scene_正在被查看,該函數不起作用。 當一個場景設置在一個視圖中,[QGraphicsScene.changed](qgraphicsscene.html#changed)( )信號會自動連接到這個視圖的[updateScene](qgraphicsview.html#updateScene)( )插槽,以及視圖的滾動條進行調整,以適應現場的大小。 **See also** [scene](qgraphicsview.html#scene)( ) 。 ``` QGraphicsView.setSceneRect (self, QRectF?rect) ``` ``` QGraphicsView.setSceneRect (self, float?ax, float?ay, float?aw, float?ah) ``` ``` QGraphicsView.setTransform (self, QTransform?matrix, bool?combine?=?False) ``` 設置視圖的當前轉換矩陣_matrix_。 If _combine_是真的,那么_matrix_是結合當前矩陣,否則_matrix_ _replaces_當前矩陣。_combine_默認為False 。 變換矩陣tranforms現場成視圖坐標。使用默認的轉變,由單位矩陣提供,在視圖中一個像素代表一個單位中的場景(例如,一個10×10的矩形項目使用視圖10X10像素繪制) 。如果一個2x2矩陣縮放應用,該場景將在1:2繪制(例如,一個10×10的矩形產品,然后使用視圖20×20像素繪制) 。 例如: ``` [QGraphicsScene](qgraphicsscene.html) scene; scene.addText("GraphicsView rotated clockwise"); [QGraphicsView](qgraphicsview.html) view(&scene); view.rotate(90); // the text is rendered with a 90 degree clockwise rotation view.show(); ``` 為了簡化互為作用與使用轉換視圖中的項目,[QGraphicsView](qgraphicsview.html)提供mapTo ...和mapFrom ...功能,可以現場和視圖坐標之間的轉換。例如,你可以調用[mapToScene](qgraphicsview.html#mapToScene)( )到一個視圖coordiate映射到一個浮點場景坐標,或[mapFromScene](qgraphicsview.html#mapFromScene)()從浮點數的場景地圖坐標,查看坐標。 **See also** [transform](qgraphicsview.html#transform)( )[rotate](qgraphicsview.html#rotate)( )[scale](qgraphicsview.html#scale)( )[shear](qgraphicsview.html#shear)()和[translate](qgraphicsview.html#translate)( ) 。 ``` QGraphicsView.setTransformationAnchor (self, ViewportAnchor?anchor) ``` ``` QGraphicsView.setupViewport (self, QWidget?widget) ``` 這種方法也是一個Qt槽與C + +的簽名`void setupViewport(QWidget *)`。 這個槽被調用者[QAbstractScrollArea](qabstractscrollarea.html)后[setViewport](qabstractscrollarea.html#setViewport)( )被調用。在子類重新實現此功能[QGraphicsView](qgraphicsview.html)初始化新視_widget_之前就被采用。 **See also** [setViewport](qabstractscrollarea.html#setViewport)( ) 。 ``` QGraphicsView.setViewportUpdateMode (self, ViewportUpdateMode?mode) ``` ``` QGraphicsView.shear (self, float?sh, float?sv) ``` 由(剪當前視圖轉型_sh_,_sv_) 。 **See also** [setTransform](qgraphicsview.html#setTransform)( )[transform](qgraphicsview.html#transform)( )[rotate](qgraphicsview.html#rotate)( )[scale](qgraphicsview.html#scale)()和[translate](qgraphicsview.html#translate)( ) 。 ``` QGraphicsView.showEvent (self, QShowEvent?event) ``` 從重新實現[QWidget.showEvent](qwidget.html#showEvent)( ) 。 ``` QSize QGraphicsView.sizeHint (self) ``` [](qsize.html) [從重新實現](qsize.html)[QWidget.sizeHint](qwidget.html#sizeHint-prop)( ) 。 ``` QTransform QGraphicsView.transform (self) ``` [ 返回該視圖的當前轉換矩陣。如果沒有當前變換設置,返回單位矩陣。 ](qtransform.html) [**See also**](qtransform.html) [setTransform](qgraphicsview.html#setTransform)( )[rotate](qgraphicsview.html#rotate)( )[scale](qgraphicsview.html#scale)( )[shear](qgraphicsview.html#shear)()和[translate](qgraphicsview.html#translate)( ) 。 ``` ViewportAnchor QGraphicsView.transformationAnchor (self) ``` [ ``` QGraphicsView.translate (self, float?dx, float?dy) ``` 由(平移當前視圖轉型_dx_,_dy_) 。 ](qgraphicsview.html#ViewportAnchor-enum) [**See also**](qgraphicsview.html#ViewportAnchor-enum) [setTransform](qgraphicsview.html#setTransform)( )[transform](qgraphicsview.html#transform)( )[rotate](qgraphicsview.html#rotate)()和[shear](qgraphicsview.html#shear)( ) 。 ``` QGraphicsView.updateScene (self, list-of-QRectF?rects) ``` 這種方法也是一個Qt槽與C + +的簽名`void updateScene(const QList&lt;QRectF&gt;&)`。 附表現場矩形的更新_rects_。 **See also** [QGraphicsScene.changed](qgraphicsscene.html#changed)( ) 。 ``` QGraphicsView.updateSceneRect (self, QRectF?rect) ``` 這種方法也是一個Qt槽與C + +的簽名`void updateSceneRect(const QRectF&)`。 通知[QGraphicsView](qgraphicsview.html)該場景的場景RECT發生了變化。_rect_是新的場景正確。如果視圖已經有一個明確設定的場景矩形,該函數不起作用。 **See also** [sceneRect](qgraphicsview.html#sceneRect-prop)和[QGraphicsScene.sceneRectChanged](qgraphicsscene.html#sceneRectChanged)( ) 。 ``` bool QGraphicsView.viewportEvent (self, QEvent?event) ``` 從重新實現[QAbstractScrollArea.viewportEvent](qabstractscrollarea.html#viewportEvent)( ) 。 ``` QTransform QGraphicsView.viewportTransform (self) ``` [ 返回映射視口坐標場景坐標的矩陣。 ](qtransform.html) [**See also**](qtransform.html) [mapToScene](qgraphicsview.html#mapToScene)()和[mapFromScene](qgraphicsview.html#mapFromScene)( ) 。 ``` ViewportUpdateMode QGraphicsView.viewportUpdateMode (self) ``` [ ``` QGraphicsView.wheelEvent (self, QWheelEvent?event) ``` ](qgraphicsview.html#ViewportUpdateMode-enum) [從重新實現](qgraphicsview.html#ViewportUpdateMode-enum)[QWidget.wheelEvent](qwidget.html#wheelEvent)( ) 。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看