<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>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # QGraphicsScene Class Reference ## [[QtGui](index.htm) module] 在QGraphicsScene類提供了用于管理大量的2D圖形項的表面上。[More...](#details) 繼承[QObject](qobject.html)。 ### Types * `enum ItemIndexMethod { BspTreeIndex, NoIndex }` * `enum SceneLayer { ItemLayer, BackgroundLayer, ForegroundLayer, AllLayers }` * `class **[SceneLayers](index.htm)**` ### Methods * `__init__ (self, QObject?parent?=?None)` * `__init__ (self, QRectF?sceneRect, QObject?parent?=?None)` * `__init__ (self, float?x, float?y, float?width, float?height, QObject?parent?=?None)` * `QGraphicsItem activePanel (self)` * `QGraphicsWidget activeWindow (self)` * `QGraphicsEllipseItem addEllipse (self, QRectF?rect, QPen?pen?=?QPen(), QBrush?brush?=?QBrush())` * `QGraphicsEllipseItem addEllipse (self, float?x, float?y, float?w, float?h, QPen?pen?=?QPen(), QBrush?brush?=?QBrush())` * `addItem (self, QGraphicsItem?item)` * `QGraphicsLineItem addLine (self, QLineF?line, QPen?pen?=?QPen())` * `QGraphicsLineItem addLine (self, float?x1, float?y1, float?x2, float?y2, QPen?pen?=?QPen())` * `QGraphicsPathItem addPath (self, QPainterPath?path, QPen?pen?=?QPen(), QBrush?brush?=?QBrush())` * `QGraphicsPixmapItem addPixmap (self, QPixmap?pixmap)` * `QGraphicsPolygonItem addPolygon (self, QPolygonF?polygon, QPen?pen?=?QPen(), QBrush?brush?=?QBrush())` * `QGraphicsRectItem addRect (self, QRectF?rect, QPen?pen?=?QPen(), QBrush?brush?=?QBrush())` * `QGraphicsRectItem addRect (self, float?x, float?y, float?w, float?h, QPen?pen?=?QPen(), QBrush?brush?=?QBrush())` * `QGraphicsSimpleTextItem addSimpleText (self, QString?text, QFont?font?=?QFont())` * `QGraphicsTextItem addText (self, QString?text, QFont?font?=?QFont())` * `QGraphicsProxyWidget addWidget (self, QWidget?widget, Qt.WindowFlags?flags?=?0)` * `advance (self)` * `QBrush backgroundBrush (self)` * `int bspTreeDepth (self)` * `clear (self)` * `clearFocus (self)` * `clearSelection (self)` * `list-of-QGraphicsItem collidingItems (self, QGraphicsItem?item, Qt.ItemSelectionMode?mode?=?Qt.IntersectsItemShape)` * `contextMenuEvent (self, QGraphicsSceneContextMenuEvent?event)` * `QGraphicsItemGroup createItemGroup (self, list-of-QGraphicsItem?items)` * `destroyItemGroup (self, QGraphicsItemGroup?group)` * `dragEnterEvent (self, QGraphicsSceneDragDropEvent?event)` * `dragLeaveEvent (self, QGraphicsSceneDragDropEvent?event)` * `dragMoveEvent (self, QGraphicsSceneDragDropEvent?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, QWidget?widget?=?None)` * `dropEvent (self, QGraphicsSceneDragDropEvent?event)` * `bool event (self, QEvent?event)` * `bool eventFilter (self, QObject?watched, QEvent?event)` * `focusInEvent (self, QFocusEvent?event)` * `QGraphicsItem focusItem (self)` * `bool focusNextPrevChild (self, bool?next)` * `focusOutEvent (self, QFocusEvent?event)` * `QFont font (self)` * `QBrush foregroundBrush (self)` * `bool hasFocus (self)` * `float height (self)` * `helpEvent (self, QGraphicsSceneHelpEvent?event)` * `inputMethodEvent (self, QInputMethodEvent?event)` * `QVariant inputMethodQuery (self, Qt.InputMethodQuery?query)` * `invalidate (self, QRectF?rect?=?QRectF(), SceneLayers?layers?=?QGraphicsScene.AllLayers)` * `invalidate (self, float?x, float?y, float?w, float?h, SceneLayers?layers?=?QGraphicsScene.AllLayers)` * `bool isActive (self)` * `bool isSortCacheEnabled (self)` * `QGraphicsItem itemAt (self, QPointF?pos)` * `QGraphicsItem itemAt (self, float?x, float?y)` * `QGraphicsItem itemAt (self, QPointF?pos, QTransform?deviceTransform)` * `QGraphicsItem itemAt (self, float?x, float?y, QTransform?deviceTransform)` * `ItemIndexMethod itemIndexMethod (self)` * `list-of-QGraphicsItem items (self)` * `list-of-QGraphicsItem items (self, Qt.SortOrder?order)` * `list-of-QGraphicsItem items (self, QPointF?pos)` * `list-of-QGraphicsItem items (self, QPointF?pos, Qt.ItemSelectionMode?mode, Qt.SortOrder?order, QTransform?deviceTransform?=?QTransform())` * `list-of-QGraphicsItem items (self, QRectF?rectangle, Qt.ItemSelectionMode?mode?=?Qt.IntersectsItemShape)` * `list-of-QGraphicsItem items (self, QRectF?rect, Qt.ItemSelectionMode?mode, Qt.SortOrder?order, QTransform?deviceTransform?=?QTransform())` * `list-of-QGraphicsItem items (self, QPolygonF?polygon, Qt.ItemSelectionMode?mode?=?Qt.IntersectsItemShape)` * `list-of-QGraphicsItem items (self, QPolygonF?polygon, Qt.ItemSelectionMode?mode, Qt.SortOrder?order, QTransform?deviceTransform?=?QTransform())` * `list-of-QGraphicsItem items (self, QPainterPath?path, Qt.ItemSelectionMode?mode?=?Qt.IntersectsItemShape)` * `list-of-QGraphicsItem items (self, QPainterPath?path, Qt.ItemSelectionMode?mode, Qt.SortOrder?order, QTransform?deviceTransform?=?QTransform())` * `list-of-QGraphicsItem items (self, float?x, float?y, float?w, float?h, Qt.ItemSelectionMode?mode?=?Qt.IntersectsItemShape)` * `list-of-QGraphicsItem items (self, float?x, float?y, float?w, float?h, Qt.ItemSelectionMode?mode, Qt.SortOrder?order, QTransform?deviceTransform?=?QTransform())` * `QRectF itemsBoundingRect (self)` * `keyPressEvent (self, QKeyEvent?event)` * `keyReleaseEvent (self, QKeyEvent?event)` * `mouseDoubleClickEvent (self, QGraphicsSceneMouseEvent?event)` * `QGraphicsItem mouseGrabberItem (self)` * `mouseMoveEvent (self, QGraphicsSceneMouseEvent?event)` * `mousePressEvent (self, QGraphicsSceneMouseEvent?event)` * `mouseReleaseEvent (self, QGraphicsSceneMouseEvent?event)` * `QPalette palette (self)` * `removeItem (self, QGraphicsItem?item)` * `render (self, QPainter?painter, QRectF?target?=?QRectF(), QRectF?source?=?QRectF(), Qt.AspectRatioMode?mode?=?Qt.KeepAspectRatio)` * `QRectF sceneRect (self)` * `list-of-QGraphicsItem selectedItems (self)` * `QPainterPath selectionArea (self)` * `bool sendEvent (self, QGraphicsItem?item, QEvent?event)` * `setActivePanel (self, QGraphicsItem?item)` * `setActiveWindow (self, QGraphicsWidget?widget)` * `setBackgroundBrush (self, QBrush?brush)` * `setBspTreeDepth (self, int?depth)` * `setFocus (self, Qt.FocusReason?focusReason?=?Qt.OtherFocusReason)` * `setFocusItem (self, QGraphicsItem?item, Qt.FocusReason?focusReason?=?Qt.OtherFocusReason)` * `setFont (self, QFont?font)` * `setForegroundBrush (self, QBrush?brush)` * `setItemIndexMethod (self, ItemIndexMethod?method)` * `setPalette (self, QPalette?palette)` * `setSceneRect (self, QRectF?rect)` * `setSceneRect (self, float?x, float?y, float?w, float?h)` * `setSelectionArea (self, QPainterPath?path, QTransform?deviceTransform)` * `setSelectionArea (self, QPainterPath?path)` * `setSelectionArea (self, QPainterPath?path, Qt.ItemSelectionMode)` * `setSelectionArea (self, QPainterPath?path, Qt.ItemSelectionMode?mode, QTransform?deviceTransform)` * `setSortCacheEnabled (self, bool?enabled)` * `setStickyFocus (self, bool?enabled)` * `setStyle (self, QStyle?style)` * `bool stickyFocus (self)` * `QStyle style (self)` * `update (self, QRectF?rect?=?QRectF())` * `update (self, float?x, float?y, float?w, float?h)` * `list-of-QGraphicsView views (self)` * `wheelEvent (self, QGraphicsSceneWheelEvent?event)` * `float width (self)` ### Qt Signals * `void changed (const QList&lt;QRectF&gt;&)` * `void sceneRectChanged (const QRectF&)` * `void selectionChanged ()` * * * ## Detailed Description 在QGraphicsScene類提供了用于管理大量的2D圖形項的表面上。 這個類作為一個容器QGraphicsItems 。它是連同用于[QGraphicsView](qgraphicsview.html)用于可視化的二維表面的圖形化的項目,如直線,矩形,文字,甚至是自定義項目。 QGraphicsScene是部分[Graphics View Framework](index.htm)。 QGraphicsScene還提供以下功能,可以讓你有效地確定項目的兩個位置,以及確定哪些項目是在現場的任意區域內可見。與[QGraphicsView](qgraphicsview.html)窗口小部件,你可以想像整個場景,或放大,查看現場的唯一部分。 例如: ``` QGraphicsScene scene; scene.addText("Hello, world!"); [QGraphicsView](qgraphicsview.html) view(&scene); view.show(); ``` 注意, QGraphicsScene都有自己的無視覺外觀,它只管理項目。你需要創建一個[QGraphicsView](qgraphicsview.html)小工具,可視化的場景。 將項目添加到一個場景,你通過構建一個QGraphicsScene對象開始。那么,你有兩個選擇:要么加入您現有的[QGraphicsItem](qgraphicsitem.html)通過調用對象[addItem](qgraphicsscene.html#addItem)( ) ,或者您也可以撥打方便的功能之一[addEllipse](qgraphicsscene.html#addEllipse)( )[addLine](qgraphicsscene.html#addLine)( )[addPath](qgraphicsscene.html#addPath)( )[addPixmap](qgraphicsscene.html#addPixmap)( )[addPolygon](qgraphicsscene.html#addPolygon)( )[addRect](qgraphicsscene.html#addRect)() ,或[addText](qgraphicsscene.html#addText)(),它都返回一個指向新添加的項目。具有這些功能的添加物品的尺寸是相對于項目的坐標系,并在項目位置在場景初始化為( 0,0) 。 然后,您可以使用可視化的場景[QGraphicsView](qgraphicsview.html)。當場景變化時, (例如,當一個項目移動或變換) QGraphicsScene放出[changed](qgraphicsscene.html#changed)()信號。要刪除某個項目,調用[removeItem](qgraphicsscene.html#removeItem)( ) 。 QGraphicsScene使用一個索引算法能夠有效地管理項目的位置。默認情況下,一個BSP (二進制空間劃分)樹被使用;適用于大場景中的大部分項目保持靜態(即不走動)的算法。您可以選擇通過調用禁用此指數[setItemIndexMethod](qgraphicsscene.html#itemIndexMethod-prop)( ) 。有關可用的索引算法的詳細信息,請參閱[itemIndexMethod](qgraphicsscene.html#itemIndexMethod-prop)屬性。 場景的邊界矩形是通過調用設置[setSceneRect](qgraphicsscene.html#sceneRect-prop)( ) 。件可以被放置在現場的任何位置,并且場景的大小是由默認無限制。現場RECT僅用于內部簿記,維護現場的項目索引。如果場景RECT沒有設置, QGraphicsScene將使用所有項目的邊界區域,通過返回[itemsBoundingRect](qgraphicsscene.html#itemsBoundingRect)( ) ,作為場景正確。但是,[itemsBoundingRect](qgraphicsscene.html#itemsBoundingRect)( )是一個比較耗時的功能,因為它的運作通過收集位置信息用于現場每一個項目。正因為如此,你應該對大場面的操作時,總是設置場景正確。 其中一個QGraphicsScene最大的優勢是它能夠有效地確定項目的位置。即使是數以百萬計在現場的項目中,[items](qgraphicsscene.html#items)( )函數可以幾毫秒內確定一個項目的位置。有幾個重載[items](qgraphicsscene.html#items)(): 1 ,發現件在某一位置, 1 ,發現里面或具有多邊形或矩形相交,并且多個項目。返回的項目列表是通過堆疊順序排列,最上面的項目是列表中的第一項進行排序。為方便起見,也有一個[itemAt](qgraphicsscene.html#itemAt)( )函數返回在給定位置的最上方項目。 QGraphicsScene保持選擇信息的場景。要選擇項目,請致電[setSelectionArea](qgraphicsscene.html#setSelectionArea)( ) ,并清除當前的選擇,通話[clearSelection](qgraphicsscene.html#clearSelection)( ) 。通話[selectedItems](qgraphicsscene.html#selectedItems)()來獲取所有選定的項目清單。 ### Event Handling and Propagation 該QGraphicsScene有另一個責任,就是從事件傳播[QGraphicsView](qgraphicsview.html)。發送事件到場景中,你構建一個繼承的事件[QEvent](qevent.html),然后使用,例如發送,[QApplication.sendEvent](qcoreapplication.html#sendEvent)( ) 。[event](qgraphicsscene.html#event)( )負責調度事件的個別項目。一些常見的事件被方便的事件處理程序來處理。例如,按鍵事件被處理[keyPressEvent](qgraphicsscene.html#keyPressEvent)( ) ,和鼠標按下事件被處理[mousePressEvent](qgraphicsscene.html#mousePressEvent)( ) 。 關鍵事件被傳遞到_focus item_。將焦點設置項,您可以調用[setFocusItem](qgraphicsscene.html#setFocusItem)( ) ,傳遞,接受集中的項目,或項目本身可以調用[QGraphicsItem.setFocus](qgraphicsitem.html#setFocus)( ) 。通話[focusItem](qgraphicsscene.html#focusItem)( )來獲得當前焦點項目。對于小部件的相容性,現場還維護它自己的重點信息。默認情況下,現場沒有焦點,所有的關鍵事件將被丟棄。如果[setFocus](qgraphicsscene.html#setFocus)()被調用,或者在現場獲得焦點的項目,現場自動獲得焦點。如果場景有焦點,[hasFocus](qgraphicsscene.html#hasFocus)( )將返回True ,而關鍵事件將被轉發到的重點項目,如果有的話。如果場景失去焦點, (即有人呼叫[clearFocus](qgraphicsscene.html#clearFocus)( ) ),而一個項目具有焦點,現場將維持其項目重點信息,一旦現場重新獲得焦點時,它會確保最后的重點項目重新獲得焦點。 對于鼠標懸停效果, QGraphicsScene調度_hover events_。如果一個項目接受懸停事件(見[QGraphicsItem.acceptHoverEvents](qgraphicsitem.html#acceptHoverEvents)( ) ) ,它會收到一個[GraphicsSceneHoverEnter](qevent.html#Type-enum)當鼠標進入其區域的事件。當鼠標移動繼續該項目的區域內, QGraphicsScene將發送它[GraphicsSceneHoverMove](qevent.html#Type-enum)事件。當鼠標離開該項目的區域,該項目將獲得[GraphicsSceneHoverLeave](qevent.html#Type-enum)事件。 所有的鼠標事件被傳遞到當前_mouse grabber_項目。項目成為現場的鼠標抓取,如果它接受鼠標事件(見[QGraphicsItem.acceptedMouseButtons](qgraphicsitem.html#acceptedMouseButtons)( ) ),它接收鼠標按下。它保持鼠標采集卡,直到它收到一個鼠標釋放時,沒有其他的鼠標按鈕被按下。您可以致電[mouseGrabberItem](qgraphicsscene.html#mouseGrabberItem)( ) ,以確定哪些項目目前正在抓住鼠標。 * * * ## Type Documentation ``` QGraphicsScene.ItemIndexMethod ``` 這個枚舉變量描述了索引算法[QGraphicsScene](qgraphicsscene.html)為管理有關現場項目位置信息。 | Constant | Value | Description | | --- | --- | --- | | `QGraphicsScene.BspTreeIndex` | `0` | 一個二進制空間劃分樹被應用。所有[QGraphicsScene](qgraphicsscene.html)的項目定位算法是一種為了接近對數的復雜性,通過使用二進制搜索。添加,移動和刪除的項目是對數。這種方法最適合于靜態場景(即場景中的大部分項目不動) 。 | | `QGraphicsScene.NoIndex` | `-1` | 沒有索引被應用。項目位置的線性復雜度,因為在現場的所有項目進行搜索。添加,移動和刪除的項目,然而,在常數時間內完成。這種方法非常適合于動態場景,許多項目被添加,移動或刪除連續。 | **See also** [setItemIndexMethod](qgraphicsscene.html#itemIndexMethod-prop)()和[bspTreeDepth](qgraphicsscene.html#bspTreeDepth-prop)。 ``` QGraphicsScene.SceneLayer ``` 這個枚舉變量描述了一個渲染層[QGraphicsScene](qgraphicsscene.html)。何時[QGraphicsScene](qgraphicsscene.html)繪制的場景內容,它使得每一層分開,為了。 每一層代表可調用的功能,如當被OR'ed在一起的標志[invalidate](qgraphicsscene.html#invalidate)()或[QGraphicsView.invalidateScene](qgraphicsview.html#invalidateScene)( ) 。 | Constant | Value | Description | | --- | --- | --- | | `QGraphicsScene.ItemLayer` | `0x1` | 該項目層。[QGraphicsScene](qgraphicsscene.html)渲染所有的項目都在這一層通過調用虛函數[drawItems](index.htm#drawItems)( ) 。該項目層繪制背景層之后,但在此之前的前景層。 | | `QGraphicsScene.BackgroundLayer` | `0x2` | 背景層。[QGraphicsScene](qgraphicsscene.html)通過調用虛函數渲染場景的背景在這一層[drawBackground](qgraphicsscene.html#drawBackground)( ) 。背景層首先所有圖層的繪制。 | | `QGraphicsScene.ForegroundLayer` | `0x4` | 前景層。[QGraphicsScene](qgraphicsscene.html)通過調用虛函數呈現在這一層場景的前景[drawForeground](qgraphicsscene.html#drawForeground)( ) 。前景層被最后繪制所有層。 | | `QGraphicsScene.AllLayers` | `0xffff` | 所有的層,這個值表示所有三個層的結合。 | 這個枚舉被引入或修改的Qt 4.3 。 該SceneLayers類型是一個typedef為[QFlags](index.htm)\u003cSceneLayer\u003e 。它存儲SceneLayer值的或組合。 **See also** [invalidate](qgraphicsscene.html#invalidate)()和[QGraphicsView.invalidateScene](qgraphicsview.html#invalidateScene)( ) 。 * * * ## Method Documentation ``` QGraphicsScene.__init__ (self, QObject?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個[QGraphicsScene](qgraphicsscene.html)對象。該_parent_參數被傳遞到[QObject](qobject.html)的構造。 ``` QGraphicsScene.__init__ (self, QRectF?sceneRect, QObject?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個[QGraphicsScene](qgraphicsscene.html)對象,使用_sceneRect_其場景區域。該_parent_參數被傳遞到[QObject](qobject.html)的構造。 **See also** [sceneRect](qgraphicsscene.html#sceneRect-prop)。 ``` QGraphicsScene.__init__ (self, float?x, float?y, float?width, float?height, QObject?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個[QGraphicsScene](qgraphicsscene.html)Object,使用(指定的矩形_x_,_y_) ,并在給定_width_和_height_其場景區域。該_parent_參數被傳遞到[QObject](qobject.html)的構造。 **See also** [sceneRect](qgraphicsscene.html#sceneRect-prop)。 ``` QGraphicsItem QGraphicsScene.activePanel (self) ``` [ 返回當前的面板,或者0 ,如果沒有面板是目前活躍。 此功能被引入Qt的4.6 。 ](qgraphicsitem.html) [**See also**](qgraphicsitem.html) [QGraphicsScene.setActivePanel](qgraphicsscene.html#setActivePanel)( ) 。 ``` QGraphicsWidget QGraphicsScene.activeWindow (self) ``` [ 返回當前活動窗口,或者0,如果沒有窗口當前處于活動狀態。 此功能被引入Qt的4.4 。 ](qgraphicswidget.html) [**See also**](qgraphicswidget.html) [QGraphicsScene.setActiveWindow](qgraphicsscene.html#setActiveWindow)( ) 。 ``` QGraphicsEllipseItem QGraphicsScene.addEllipse (self, QRectF?rect, QPen?pen?=?QPen(), QBrush?brush?=?QBrush()) ``` [ 創建并添加一個橢圓項目現場,并返回該項的指針。橢圓的幾何形狀被定義為_rect_,其筆和刷子被初始化為_pen_和_brush_。 注意,該產品的幾何形狀在產品的坐標提供,并且它的位置被初始化為( 0,0) 。 ](qgraphicsellipseitem.html) [如果該項目是可見的(即,](qgraphicsellipseitem.html)[QGraphicsItem.isVisible](qgraphicsitem.html#isVisible)( )返回True ) ,[QGraphicsScene](qgraphicsscene.html)會發出[changed](qgraphicsscene.html#changed)( )一旦控制返回到事件循環。 **See also** [addLine](qgraphicsscene.html#addLine)( )[addPath](qgraphicsscene.html#addPath)( )[addPixmap](qgraphicsscene.html#addPixmap)( )[addRect](qgraphicsscene.html#addRect)( )[addText](qgraphicsscene.html#addText)( )[addItem](qgraphicsscene.html#addItem)()和[addWidget](qgraphicsscene.html#addWidget)( ) 。 ``` QGraphicsEllipseItem QGraphicsScene.addEllipse (self, float?x, float?y, float?w, float?h, QPen?pen?=?QPen(), QBrush?brush?=?QBrush()) ``` [](qgraphicsellipseitem.html) [這個方便的功能等同于調用addEllipse (](qgraphicsellipseitem.html)[QRectF](qrectf.html)(_x_,_y_,_w_,_h_) ,_pen_,_brush_) 。 此功能被引入Qt的4.3 。 ``` QGraphicsScene.addItem (self, QGraphicsItem?item) ``` 該_item_說法有它的所有權轉移給Qt的。 添加或移動_item_和所有的童裝到了這一幕。這一幕發生的所有權_item_。 如果該項目是可見的(即,[QGraphicsItem.isVisible](qgraphicsitem.html#isVisible)( )返回True ) ,[QGraphicsScene](qgraphicsscene.html)會發出[changed](qgraphicsscene.html#changed)( )一旦控制返回到事件循環。 如果該項目已經在不同的場景,它會首先從它的舊場景去掉,然后加入到這一場景的頂層。 [QGraphicsScene](qgraphicsscene.html)將發送ItemSceneChange通知_item_而它被添加到場景中。如果項目目前并不屬于一個場景,只有一個發送通知。如果它不屬于現場已經(即,它被移動到了這一幕) ,[QGraphicsScene](qgraphicsscene.html)作為該項目是由它的前一個場景中刪除將發送另外通知。 如果該項目是一個面板,場面活躍,而且沒有活動面板中的場景,那么該項目將被激活。 **See also** [removeItem](qgraphicsscene.html#removeItem)( )[addEllipse](qgraphicsscene.html#addEllipse)( )[addLine](qgraphicsscene.html#addLine)( )[addPath](qgraphicsscene.html#addPath)( )[addPixmap](qgraphicsscene.html#addPixmap)( )[addRect](qgraphicsscene.html#addRect)( )[addText](qgraphicsscene.html#addText)( )[addWidget](qgraphicsscene.html#addWidget)()和[Sorting](qgraphicsitem.html#sorting)。 ``` QGraphicsLineItem QGraphicsScene.addLine (self, QLineF?line, QPen?pen?=?QPen()) ``` [ 創建并增加了一個行項目現場,并返回該項的指針。線的幾何形狀被定義為_line_,其筆被初始化為_pen_。 注意,該產品的幾何形狀在產品的坐標提供,并且它的位置被初始化為( 0,0) 。 ](qgraphicslineitem.html) [如果該項目是可見的(即,](qgraphicslineitem.html)[QGraphicsItem.isVisible](qgraphicsitem.html#isVisible)( )返回True ) ,[QGraphicsScene](qgraphicsscene.html)會發出[changed](qgraphicsscene.html#changed)( )一旦控制返回到事件循環。 **See also** [addEllipse](qgraphicsscene.html#addEllipse)( )[addPath](qgraphicsscene.html#addPath)( )[addPixmap](qgraphicsscene.html#addPixmap)( )[addRect](qgraphicsscene.html#addRect)( )[addText](qgraphicsscene.html#addText)( )[addItem](qgraphicsscene.html#addItem)()和[addWidget](qgraphicsscene.html#addWidget)( ) 。 ``` QGraphicsLineItem QGraphicsScene.addLine (self, float?x1, float?y1, float?x2, float?y2, QPen?pen?=?QPen()) ``` [](qgraphicslineitem.html) [這個方便的功能等同于調用addLine (](qgraphicslineitem.html)[QLineF](qlinef.html)(_x1_,_y1_,_x2_,_y2_) ,_pen_) 。 此功能被引入Qt的4.3 。 ``` QGraphicsPathItem QGraphicsScene.addPath (self, QPainterPath?path, QPen?pen?=?QPen(), QBrush?brush?=?QBrush()) ``` [ 創建并添加一個路徑項目現場,并返回該項的指針。的路徑的幾何形狀被定義為_path_,其筆和刷子被初始化為_pen_和_brush_。 注意,該產品的幾何形狀在產品的坐標提供,并且它的位置被初始化為( 0,0) 。 ](qgraphicspathitem.html) [如果該項目是可見的(即,](qgraphicspathitem.html)[QGraphicsItem.isVisible](qgraphicsitem.html#isVisible)( )返回True ) ,[QGraphicsScene](qgraphicsscene.html)會發出[changed](qgraphicsscene.html#changed)( )一旦控制返回到事件循環。 **See also** [addEllipse](qgraphicsscene.html#addEllipse)( )[addLine](qgraphicsscene.html#addLine)( )[addPixmap](qgraphicsscene.html#addPixmap)( )[addRect](qgraphicsscene.html#addRect)( )[addText](qgraphicsscene.html#addText)( )[addItem](qgraphicsscene.html#addItem)()和[addWidget](qgraphicsscene.html#addWidget)( ) 。 ``` QGraphicsPixmapItem QGraphicsScene.addPixmap (self, QPixmap?pixmap) ``` [ 創建并增加了一個圖片項目現場,并返回該項的指針。像素圖被定義為_pixmap_。 注意,該產品的幾何形狀在產品的坐標提供,并且它的位置被初始化為( 0,0) 。 ](qgraphicspixmapitem.html) [如果該項目是可見的(即,](qgraphicspixmapitem.html)[QGraphicsItem.isVisible](qgraphicsitem.html#isVisible)( )返回True ) ,[QGraphicsScene](qgraphicsscene.html)會發出[changed](qgraphicsscene.html#changed)( )一旦控制返回到事件循環。 **See also** [addEllipse](qgraphicsscene.html#addEllipse)( )[addLine](qgraphicsscene.html#addLine)( )[addPath](qgraphicsscene.html#addPath)( )[addRect](qgraphicsscene.html#addRect)( )[addText](qgraphicsscene.html#addText)( )[addItem](qgraphicsscene.html#addItem)()和[addWidget](qgraphicsscene.html#addWidget)( ) 。 ``` QGraphicsPolygonItem QGraphicsScene.addPolygon (self, QPolygonF?polygon, QPen?pen?=?QPen(), QBrush?brush?=?QBrush()) ``` [ 創建并增加了一個多邊形項目現場,并返回該項的指針。多邊形被定義為_polygon_,其筆和刷子被初始化為_pen_和_brush_。 注意,該產品的幾何形狀在產品的坐標提供,并且它的位置被初始化為( 0,0) 。 ](qgraphicspolygonitem.html) [如果該項目是可見的(即,](qgraphicspolygonitem.html)[QGraphicsItem.isVisible](qgraphicsitem.html#isVisible)( )返回True ) ,[QGraphicsScene](qgraphicsscene.html)會發出[changed](qgraphicsscene.html#changed)( )一旦控制返回到事件循環。 **See also** [addEllipse](qgraphicsscene.html#addEllipse)( )[addLine](qgraphicsscene.html#addLine)( )[addPath](qgraphicsscene.html#addPath)( )[addRect](qgraphicsscene.html#addRect)( )[addText](qgraphicsscene.html#addText)( )[addItem](qgraphicsscene.html#addItem)()和[addWidget](qgraphicsscene.html#addWidget)( ) 。 ``` QGraphicsRectItem QGraphicsScene.addRect (self, QRectF?rect, QPen?pen?=?QPen(), QBrush?brush?=?QBrush()) ``` [ 創建并添加一個矩形項目現場,并返回該項的指針。矩形的幾何形狀被定義為_rect_,其筆和刷子被初始化為_pen_和_brush_。 ](qgraphicsrectitem.html) [注意,該產品的幾何形狀在產品的坐標提供,并且它的位置被初始化為( 0,0) 。例如,如果一個](qgraphicsrectitem.html)[QRect](qrect.html)(50, 50 ,100,100 )被添加,其左上角將在(50 ,50)相對于原點的物品的坐標系。 如果該項目是可見的(即,[QGraphicsItem.isVisible](qgraphicsitem.html#isVisible)( )返回True ) ,[QGraphicsScene](qgraphicsscene.html)會發出[changed](qgraphicsscene.html#changed)( )一旦控制返回到事件循環。 **See also** [addEllipse](qgraphicsscene.html#addEllipse)( )[addLine](qgraphicsscene.html#addLine)( )[addPixmap](qgraphicsscene.html#addPixmap)( )[addPixmap](qgraphicsscene.html#addPixmap)( )[addText](qgraphicsscene.html#addText)( )[addItem](qgraphicsscene.html#addItem)()和[addWidget](qgraphicsscene.html#addWidget)( ) 。 ``` QGraphicsRectItem QGraphicsScene.addRect (self, float?x, float?y, float?w, float?h, QPen?pen?=?QPen(), QBrush?brush?=?QBrush()) ``` [](qgraphicsrectitem.html) [這個方便的功能等同于調用addRect (](qgraphicsrectitem.html)[QRectF](qrectf.html)(_x_,_y_,_w_,_h_) ,_pen_,_brush_) 。 此功能被引入Qt的4.3 。 ``` QGraphicsSimpleTextItem QGraphicsScene.addSimpleText (self, QString?text, QFont?font?=?QFont()) ``` [](qgraphicssimpletextitem.html) [創建并增加了一個](qgraphicssimpletextitem.html)[QGraphicsSimpleTextItem](qgraphicssimpletextitem.html)到了現場,并返回該項的指針。文本字符串被初始化為_text_和其字體被初始化為_font_。 該項目的位置被初始化為( 0,0) 。 如果該項目是可見的(即,[QGraphicsItem.isVisible](qgraphicsitem.html#isVisible)( )返回True ) ,[QGraphicsScene](qgraphicsscene.html)會發出[changed](qgraphicsscene.html#changed)( )一旦控制返回到事件循環。 **See also** [addEllipse](qgraphicsscene.html#addEllipse)( )[addLine](qgraphicsscene.html#addLine)( )[addPixmap](qgraphicsscene.html#addPixmap)( )[addPixmap](qgraphicsscene.html#addPixmap)( )[addRect](qgraphicsscene.html#addRect)( )[addItem](qgraphicsscene.html#addItem)()和[addWidget](qgraphicsscene.html#addWidget)( ) 。 ``` QGraphicsTextItem QGraphicsScene.addText (self, QString?text, QFont?font?=?QFont()) ``` [ 創建并添加一個文本項目現場,并返回該項的指針。文本字符串被初始化為_text_和其字體被初始化為_font_。 該項目的位置被初始化為( 0,0) 。 ](qgraphicstextitem.html) [如果該項目是可見的(即,](qgraphicstextitem.html)[QGraphicsItem.isVisible](qgraphicsitem.html#isVisible)( )返回True ) ,[QGraphicsScene](qgraphicsscene.html)會發出[changed](qgraphicsscene.html#changed)( )一旦控制返回到事件循環。 **See also** [addEllipse](qgraphicsscene.html#addEllipse)( )[addLine](qgraphicsscene.html#addLine)( )[addPixmap](qgraphicsscene.html#addPixmap)( )[addPixmap](qgraphicsscene.html#addPixmap)( )[addRect](qgraphicsscene.html#addRect)( )[addItem](qgraphicsscene.html#addItem)()和[addWidget](qgraphicsscene.html#addWidget)( ) 。 ``` QGraphicsProxyWidget QGraphicsScene.addWidget (self, QWidget?widget, Qt.WindowFlags?flags?=?0) ``` [ 該_widget_說法有它的所有權轉移給Qt的。 ](qgraphicsproxywidget.html) [創建一個新的](qgraphicsproxywidget.html)[QGraphicsProxyWidget](qgraphicsproxywidget.html)為_widget_,將其添加到場景中,并返回一個指針到代理。_wFlags_設置默認的窗口標志嵌入代理部件。 該項目的位置被初始化為( 0,0) 。 如果該項目是可見的(即,[QGraphicsItem.isVisible](qgraphicsitem.html#isVisible)( )返回True ) ,[QGraphicsScene](qgraphicsscene.html)會發出[changed](qgraphicsscene.html#changed)( )一旦控制返回到事件循環。 需要注意的是小部件與[Qt.WA_PaintOnScreen](qt.html#WidgetAttribute-enum)小部件的屬性設置和不支持的小工具,包裝外部應用程序或控制器。例子是[QGLWidget](qglwidget.html)和[QAxWidget](index.htm)。 **See also** [addEllipse](qgraphicsscene.html#addEllipse)( )[addLine](qgraphicsscene.html#addLine)( )[addPixmap](qgraphicsscene.html#addPixmap)( )[addPixmap](qgraphicsscene.html#addPixmap)( )[addRect](qgraphicsscene.html#addRect)( )[addText](qgraphicsscene.html#addText)( )[addSimpleText](qgraphicsscene.html#addSimpleText)()和[addItem](qgraphicsscene.html#addItem)( ) 。 ``` QGraphicsScene.advance (self) ``` 這種方法也是一個Qt槽與C + +的簽名`void advance()`。 這個插槽_advances_現場一步,通過調用[QGraphicsItem.advance](qgraphicsitem.html#advance)()用于在現場的所有項目。這樣做是在兩個階段:在第一階段,所有的項目都通知到場即將改變,而在第二階段的所有項目都通知他們可以移動。在第一階段,[QGraphicsItem.advance](qgraphicsitem.html#advance)()被調用傳遞0值作為參數,并且1被傳遞到第二階段。 **See also** [QGraphicsItem.advance](qgraphicsitem.html#advance)( )[QGraphicsItemAnimation](qgraphicsitemanimation.html)和[QTimeLine](qtimeline.html)。 ``` QBrush QGraphicsScene.backgroundBrush (self) ``` [ ``` int QGraphicsScene.bspTreeDepth (self) ``` ``` QGraphicsScene.clear (self) ``` 這種方法也是一個Qt槽與C + +的簽名`void clear()`。 刪除,并刪除所有項目從場景,但其他原因而離開現場的不變的狀態。 此功能被引入Qt的4.4 。 ](qbrush.html) [**See also**](qbrush.html) [addItem](qgraphicsscene.html#addItem)( ) 。 ``` QGraphicsScene.clearFocus (self) ``` 從現場清除焦點。如果有任何項目具有焦點時,這個函數被調用時,它會失去焦點,并再次重新獲得焦點,一旦現場重新獲得焦點。 不具有焦點場景忽略的關鍵事件。 **See also** [hasFocus](qgraphicsscene.html#hasFocus)( )[setFocus](qgraphicsscene.html#setFocus)()和[setFocusItem](qgraphicsscene.html#setFocusItem)( ) 。 ``` QGraphicsScene.clearSelection (self) ``` 清除當前的選擇。 **See also** [setSelectionArea](qgraphicsscene.html#setSelectionArea)()和[selectedItems](qgraphicsscene.html#selectedItems)( ) 。 ``` list-of-QGraphicsItem QGraphicsScene.collidingItems (self, QGraphicsItem?item, Qt.ItemSelectionMode?mode?=?Qt.IntersectsItemShape) ``` 返回與碰撞的所有項目的列表_item_。碰撞是通過調用確定[QGraphicsItem.collidesWithItem](qgraphicsitem.html#collidesWithItem)();碰撞檢測是通過測定_mode_。默認情況下,所有的項目,其形狀相交_item_或者是包含內部_item_的形狀返回。 該項目以遞減順序堆疊(即,在列表中的第一個項目是最上面的項目,最后項目是最下面的項目)返回。 **See also** [items](qgraphicsscene.html#items)( )[itemAt](qgraphicsscene.html#itemAt)( )[QGraphicsItem.collidesWithItem](qgraphicsitem.html#collidesWithItem)()和[Sorting](qgraphicsitem.html#sorting)。 ``` QGraphicsScene.contextMenuEvent (self, QGraphicsSceneContextMenuEvent?event) ``` 此事件處理程序,對于事件_contextMenuEvent_,可重新實現在子類中獲得上下文菜單事件。默認實現轉發的事件接受上下文菜單事件的事件的位置的最上方項目。如果沒有任何項目接受上下文菜單事件在這個位置上,??事件被忽略。 **See also** [QGraphicsItem.contextMenuEvent](qgraphicsitem.html#contextMenuEvent)( ) 。 ``` QGraphicsItemGroup QGraphicsScene.createItemGroup (self, list-of-QGraphicsItem?items) ``` [ 該_items_說法有它的所有權轉移給Qt的。 ](qgraphicsitemgroup.html) [組中的所有項目_items_成一個新的](qgraphicsitemgroup.html)[QGraphicsItemGroup](qgraphicsitemgroup.html),并返回一個指針到組。該組與共同祖先創造_items_作為其父,并與位置(0 ,0)。該項目全部重設父到組,以及它們的位置和轉換映射到該組。如果_items_是空的,這個函數會返回一個空的頂層[QGraphicsItemGroup](qgraphicsitemgroup.html)。 [QGraphicsScene](qgraphicsscene.html)有團體項目的所有權,你不需要刪除它。拆除(取消組合)一組,呼[destroyItemGroup](qgraphicsscene.html#destroyItemGroup)( ) 。 **See also** [destroyItemGroup](qgraphicsscene.html#destroyItemGroup)()和[QGraphicsItemGroup.addToGroup](qgraphicsitemgroup.html#addToGroup)( ) 。 ``` QGraphicsScene.destroyItemGroup (self, QGraphicsItemGroup?group) ``` 該_group_說法有它的所有權轉移給Qt的。 Reparents中的所有項目_group_至_group_的父項,然后刪除_group_從現場,終于將其刪除。該項目的位置和轉換是從組映射到集團母公司。 **See also** [createItemGroup](qgraphicsscene.html#createItemGroup)()和[QGraphicsItemGroup.removeFromGroup](qgraphicsitemgroup.html#removeFromGroup)( ) 。 ``` QGraphicsScene.dragEnterEvent (self, QGraphicsSceneDragDropEvent?event) ``` 此事件處理程序,對于事件_event_,可重新實現在子類中接收拖動進入事件現場。 默認實現接受事件并準備現場接受拖動移動事件。 **See also** [QGraphicsItem.dragEnterEvent](qgraphicsitem.html#dragEnterEvent)( )[dragMoveEvent](qgraphicsscene.html#dragMoveEvent)( )[dragLeaveEvent](qgraphicsscene.html#dragLeaveEvent)()和[dropEvent](qgraphicsscene.html#dropEvent)( ) 。 ``` QGraphicsScene.dragLeaveEvent (self, QGraphicsSceneDragDropEvent?event) ``` 此事件處理程序,對于事件_event_,可重新實現在子類中接收拖動離開事件現場。 **See also** [QGraphicsItem.dragLeaveEvent](qgraphicsitem.html#dragLeaveEvent)( )[dragEnterEvent](qgraphicsscene.html#dragEnterEvent)( )[dragMoveEvent](qgraphicsscene.html#dragMoveEvent)()和[dropEvent](qgraphicsscene.html#dropEvent)( ) 。 ``` QGraphicsScene.dragMoveEvent (self, QGraphicsSceneDragDropEvent?event) ``` 此事件處理程序,對于事件_event_,可重新實現在子類中接收拖放移動事件現場。 **See also** [QGraphicsItem.dragMoveEvent](qgraphicsitem.html#dragMoveEvent)( )[dragEnterEvent](qgraphicsscene.html#dragEnterEvent)( )[dragLeaveEvent](qgraphicsscene.html#dragLeaveEvent)()和[dropEvent](qgraphicsscene.html#dropEvent)( ) 。 ``` QGraphicsScene.drawBackground (self, QPainter?painter, QRectF?rect) ``` 繪制的場景采用背景_painter_之前,任何產品和前景繪制。重新實現此功能提供了自定義背景的場景。 所有的繪制是在做_scene_坐標。該_rect_參數是暴露的矩形。 如果你想要的是定義一個顏色,紋理或漸變的背景,你可以調用[setBackgroundBrush](qgraphicsscene.html#backgroundBrush-prop)( )來代替。 **See also** [drawForeground](qgraphicsscene.html#drawForeground)()和[drawItems](index.htm#drawItems)( ) 。 ``` QGraphicsScene.drawForeground (self, QPainter?painter, QRectF?rect) ``` 繪制場景的使用前景_painter_,背景和所有項目后已經制定。重新實現這個函數提供一個自定義前景的場景。 所有的繪制是在做_scene_坐標。該_rect_參數是暴露的矩形。 如果你想要的是定義一個顏色,紋理或漸變的前景,你可以調用[setForegroundBrush](qgraphicsscene.html#foregroundBrush-prop)( )來代替。 **See also** [drawBackground](qgraphicsscene.html#drawBackground)()和[drawItems](index.htm#drawItems)( ) 。 ``` QGraphicsScene.drawItems (self, QPainter?painter, list-of-QGraphicsItem?items, list-of-QStyleOptionGraphicsItem?options, QWidget?widget?=?None) ``` ``` QGraphicsScene.dropEvent (self, QGraphicsSceneDragDropEvent?event) ``` 此事件處理程序,對于事件_event_,可重新實現在子類中接收拖放事件的現場。 **See also** [QGraphicsItem.dropEvent](qgraphicsitem.html#dropEvent)( )[dragEnterEvent](qgraphicsscene.html#dragEnterEvent)( )[dragMoveEvent](qgraphicsscene.html#dragMoveEvent)()和[dragLeaveEvent](qgraphicsscene.html#dragLeaveEvent)( ) 。 ``` bool QGraphicsScene.event (self, QEvent?event) ``` 從重新實現[QObject.event](qobject.html#event)( ) 。 處理事件_event_,并分派到相應的事件處理程序。 除了調用方便的事件處理程序,這個功能是負責將鼠標移動事件懸停事件時,沒有鼠標采集項目。懸停事件直接交付給項目,沒有方便的功能他們。 不像[QWidget](qwidget.html),[QGraphicsScene](qgraphicsscene.html)不具備的便利功能[enterEvent()](qwidget.html#enterEvent)和[leaveEvent()](qwidget.html#leaveEvent)。使用此功能來獲得這些事件來代替。 **See also** [contextMenuEvent](qgraphicsscene.html#contextMenuEvent)( )[keyPressEvent](qgraphicsscene.html#keyPressEvent)( )[keyReleaseEvent](qgraphicsscene.html#keyReleaseEvent)( )[mousePressEvent](qgraphicsscene.html#mousePressEvent)( )[mouseMoveEvent](qgraphicsscene.html#mouseMoveEvent)( )[mouseReleaseEvent](qgraphicsscene.html#mouseReleaseEvent)( )[mouseDoubleClickEvent](qgraphicsscene.html#mouseDoubleClickEvent)( )[focusInEvent](qgraphicsscene.html#focusInEvent)()和[focusOutEvent](qgraphicsscene.html#focusOutEvent)( ) 。 ``` bool QGraphicsScene.eventFilter (self, QObject?watched, QEvent?event) ``` 從重新實現[QObject.eventFilter](qobject.html#eventFilter)( ) 。 [QGraphicsScene](qgraphicsscene.html) filters [QApplication](qapplication.html)的事件,以檢測調色板和字體的變化。 ``` QGraphicsScene.focusInEvent (self, QFocusEvent?event) ``` 此事件處理程序,對于事件_focusEvent_,可重新實現在子類中要獲得焦點的事件。 默認實現將焦點設置在現場,然后在最后一個重點項目。 **See also** [QGraphicsItem.focusOutEvent](qgraphicsitem.html#focusOutEvent)( ) 。 ``` QGraphicsItem QGraphicsScene.focusItem (self) ``` [ 當現場被激活,該函數返回現場目前的重點項目,或者0,如果沒有項目目前具有焦點。當場景是無效的,這個函數返回將獲得輸入焦點時的情景被激活的項目。 重點項目接收鍵盤輸入的時候,現場收到一個關鍵事件。 ](qgraphicsitem.html) [**See also**](qgraphicsitem.html) [setFocusItem](qgraphicsscene.html#setFocusItem)( )[QGraphicsItem.hasFocus](qgraphicsitem.html#hasFocus)()和[isActive](qgraphicsscene.html#isActive)( ) 。 ``` bool QGraphicsScene.focusNextPrevChild (self, bool?next) ``` 發現一個新的widget ,讓鍵盤焦點,以適合Tab和Shift + Tab鍵,如果能找到一個新的widget返回True ,否則返回FALSE ,如果它不能。如果_next_誠然,這個函數向前搜索,如果_next_是假的,它向后搜索。 您可以在子類中重新實現這個功能[QGraphicsScene](qgraphicsscene.html)提供細粒度地控制標籤焦點傳遞你的場景里面。默認的實現是基于定義的選項卡焦點鏈[QGraphicsWidget.setTabOrder](qgraphicswidget.html#setTabOrder)( ) 。 此功能被引入Qt的4.4 。 ``` QGraphicsScene.focusOutEvent (self, QFocusEvent?event) ``` 此事件處理程序,對于事件_focusEvent_,可重新實現在子類中獲得了焦點事件。 默認實現消除重點從任何重點項目,然后從現場移除焦點。 **See also** [QGraphicsItem.focusInEvent](qgraphicsitem.html#focusInEvent)( ) 。 ``` QFont QGraphicsScene.font (self) ``` [](qfont.html) ``` QBrush QGraphicsScene.foregroundBrush (self) ``` [ ``` bool QGraphicsScene.hasFocus (self) ``` ](qbrush.html) [返回True如果現場有焦點,否則返回False 。如果場景有焦點,它將會把關鍵事件從](qbrush.html)[QKeyEvent](qkeyevent.html)到具有焦點的任何項目。 **See also** [setFocus](qgraphicsscene.html#setFocus)()和[setFocusItem](qgraphicsscene.html#setFocusItem)( ) 。 ``` float QGraphicsScene.height (self) ``` 這個方便的功能等同于調用`sceneRect().height()`。 **See also** [width](qgraphicsscene.html#width)( ) 。 ``` QGraphicsScene.helpEvent (self, QGraphicsSceneHelpEvent?event) ``` 此事件處理程序,對于事件_helpEvent_,可重新實現在子類中接受幫助的事件。該事件的類型為[QEvent.ToolTip](qevent.html#Type-enum),這在工具提示要求創建。 默認實現顯示的最上方項目,即具有最高z值的項目,在鼠標光標位置的工具提示。如果沒有項目有一個工具提示集,這個函數什么都不做。 **See also** [QGraphicsItem.toolTip](qgraphicsitem.html#toolTip)()和[QGraphicsSceneHelpEvent](qgraphicsscenehelpevent.html)。 ``` QGraphicsScene.inputMethodEvent (self, QInputMethodEvent?event) ``` 此事件處理程序,對于事件_event_,可重新實現在子類來接收輸入法事件的現場。 默認實現轉發事件到[focusItem](qgraphicsscene.html#focusItem)( ) 。如果沒有項目目前已經集中或者當前焦點項目不接受輸入法,這個函數不執行任何操作。 **See also** [QGraphicsItem.inputMethodEvent](qgraphicsitem.html#inputMethodEvent)( ) 。 ``` QVariant QGraphicsScene.inputMethodQuery (self, Qt.InputMethodQuery?query) ``` 此方法用于通過輸入法來查詢一組場景的屬性,能夠支持復雜的輸入法操作為周圍的文字和reconversions支持。 該_query_參數指定了屬性進行查詢。 **See also** [QWidget.inputMethodQuery](qwidget.html#inputMethodQuery)( ) 。 ``` QGraphicsScene.invalidate (self, QRectF?rect?=?QRectF(), SceneLayers?layers?=?QGraphicsScene.AllLayers) ``` 這種方法也是一個Qt槽與C + +的簽名`void invalidate(const QRectF& = QRectF(),QGraphicsScene::SceneLayers = QGraphicsScene.AllLayers)`。 廢止及時間表的重繪_layers_在_rect_在現場。在任何緩存的內容_layers_無條件失效并重新繪制。 您可以使用此函數重載通知[QGraphicsScene](qgraphicsscene.html)的改變,背景或場景的前景。這個函數是常用的場景與基于區塊的背景來通知改變時[QGraphicsView](qgraphicsview.html)已啟用[CacheBackground](qgraphicsview.html#CacheModeFlag-enum)。 例如: ``` [QRectF](qrectf.html) TileScene.rectForTile(int x, int y) const { // Return the rectangle for the tile at position (x, y). return [QRectF](qrectf.html)(x * tileWidth, y * tileHeight, tileWidth, tileHeight); } void TileScene.setTile(int x, int y, const [QPixmap](qpixmap.html) &pixmap) { // Sets or replaces the tile at position (x, y) with pixmap. if (x >= 0 && x < numTilesH && y >= 0 && y < numTilesV) { tiles[y][x] = pixmap; invalidate(rectForTile(x, y), BackgroundLayer); } } void TileScene.drawBackground([QPainter](qpainter.html) *painter, const [QRectF](qrectf.html) &exposed) { // Draws all tiles that intersect the exposed area. for (int y = 0; y < numTilesV; ++y) { for (int x = 0; x < numTilesH; ++x) { [QRectF](qrectf.html) rect = rectForTile(x, y); if (exposed.intersects(rect)) painter->drawPixmap(rect.topLeft(), tiles[y][x]); } } } ``` 需要注意的是[QGraphicsView](qgraphicsview.html)目前支持后臺緩存只(見[QGraphicsView.CacheBackground](qgraphicsview.html#CacheModeFlag-enum)) 。此功能相當于調用[update](qgraphicsscene.html#update)( )如有層,但[BackgroundLayer](qgraphicsscene.html#SceneLayer-enum)被傳遞。 **See also** [QGraphicsView.resetCachedContent](qgraphicsview.html#resetCachedContent)( ) 。 ``` QGraphicsScene.invalidate (self, float?x, float?y, float?w, float?h, SceneLayers?layers?=?QGraphicsScene.AllLayers) ``` 這是一個重載函數。 這個方便的功能等同于調用無效([QRectF](qrectf.html)(_x_,_y_,_w_,_h_) ,_layers_) ; 此功能被引入Qt的4.3 。 ``` bool QGraphicsScene.isActive (self) ``` 返回True如果場景是活躍的(如,它是由至少一個觀察[QGraphicsView](qgraphicsview.html)這是積極的),否則返回False 。 此功能被引入Qt的4.6 。 **See also** [QGraphicsItem.isActive](qgraphicsitem.html#isActive)()和[QWidget.isActiveWindow](qwidget.html#isActiveWindow-prop)( ) 。 ``` bool QGraphicsScene.isSortCacheEnabled (self) ``` ``` QGraphicsItem QGraphicsScene.itemAt (self, QPointF?pos) ``` [ 返回指定最頂端可見項目_position_,或者0,如果有在這個位置沒有任何項目。 _deviceTransform_是適用于該視圖,??并且需要如果場景中包含忽略的轉換項目提供了轉型。 此功能被引入Qt的4.6 。 ](qgraphicsitem.html) [**See also**](qgraphicsitem.html) [items](qgraphicsscene.html#items)( )[collidingItems](qgraphicsscene.html#collidingItems)()和[Sorting](qgraphicsitem.html#sorting)。 ``` QGraphicsItem QGraphicsScene.itemAt (self, float?x, float?y) ``` [](qgraphicsitem.html) ``` QGraphicsItem QGraphicsScene.itemAt (self, QPointF?pos, QTransform?deviceTransform) ``` [ 這是一個重載函數。 返回時由(指定的位置的最上方項目_x_,_y_) ,或者0,如果有在這個位置沒有任何項目。 _deviceTransform_是適用于該視圖,??并且需要如果場景中包含忽略的轉換項目提供了轉型。 這個方便的功能等同于調用`itemAt(QPointF(x, y), deviceTransform)`。 此功能被引入Qt的4.6 。 ](qgraphicsitem.html) ``` QGraphicsItem QGraphicsScene.itemAt (self, float?x, float?y, QTransform?deviceTransform) ``` [](qgraphicsitem.html) ``` ItemIndexMethod QGraphicsScene.itemIndexMethod (self) ``` [ ``` list-of-QGraphicsItem QGraphicsScene.items (self) ``` 按降序返回堆疊順序的場景中所有項目的列表。 ](qgraphicsscene.html#ItemIndexMethod-enum) [**See also**](qgraphicsscene.html#ItemIndexMethod-enum) [addItem](qgraphicsscene.html#addItem)( )[removeItem](qgraphicsscene.html#removeItem)()和[Sorting](qgraphicsitem.html#sorting)。 ``` list-of-QGraphicsItem QGraphicsScene.items (self, Qt.SortOrder?order) ``` 返回現場的所有項目的有序列表。_order_決定堆疊順序。 **See also** [addItem](qgraphicsscene.html#addItem)( )[removeItem](qgraphicsscene.html#removeItem)()和[Sorting](qgraphicsitem.html#sorting)。 ``` list-of-QGraphicsItem QGraphicsScene.items (self, QPointF?pos) ``` 回報,這取決于所有可見項目_mode_,是在指定的_pos_在列表中使用排序_order_。 為默認值_mode_ is [Qt.IntersectsItemShape](qt.html#ItemSelectionMode-enum);所有項目的確切形狀與相交_pos_返回。 _deviceTransform_是適用于該視圖,??并且需要如果場景中包含忽略的轉換項目提供了轉型。 此功能被引入Qt的4.6 。 **See also** [itemAt](qgraphicsscene.html#itemAt)()和[Sorting](qgraphicsitem.html#sorting)。 ``` list-of-QGraphicsItem QGraphicsScene.items (self, QPointF?pos, Qt.ItemSelectionMode?mode, Qt.SortOrder?order, QTransform?deviceTransform?=?QTransform()) ``` ``` list-of-QGraphicsItem QGraphicsScene.items (self, QRectF?rectangle, Qt.ItemSelectionMode?mode?=?Qt.IntersectsItemShape) ``` ``` list-of-QGraphicsItem QGraphicsScene.items (self, QRectF?rect, Qt.ItemSelectionMode?mode, Qt.SortOrder?order, QTransform?deviceTransform?=?QTransform()) ``` ``` list-of-QGraphicsItem QGraphicsScene.items (self, QPolygonF?polygon, Qt.ItemSelectionMode?mode?=?Qt.IntersectsItemShape) ``` 這是一個重載函數。 回報,這取決于所有可見項目_mode_,是內部或相交由定義的矩形_x_,_y_,_w_和_h_,在列表中使用排序_order_。 _deviceTransform_是適用于該視圖,??并且需要如果場景中包含忽略的轉換項目提供了轉型。 此功能被引入Qt的4.6 。 ``` list-of-QGraphicsItem QGraphicsScene.items (self, QPolygonF?polygon, Qt.ItemSelectionMode?mode, Qt.SortOrder?order, QTransform?deviceTransform?=?QTransform()) ``` ``` list-of-QGraphicsItem QGraphicsScene.items (self, QPainterPath?path, Qt.ItemSelectionMode?mode?=?Qt.IntersectsItemShape) ``` ``` list-of-QGraphicsItem QGraphicsScene.items (self, QPainterPath?path, Qt.ItemSelectionMode?mode, Qt.SortOrder?order, QTransform?deviceTransform?=?QTransform()) ``` 這是一個重載函數。 回報,這取決于所有可見項目_mode_,是內部或相交與指定_rect_并返回一個列表排序的使用_order_。 為默認值_mode_ is [Qt.IntersectsItemShape](qt.html#ItemSelectionMode-enum);所有項目的確切形狀相交或包含由_rect_返回。 _deviceTransform_是適用于該視圖,??并且需要如果場景中包含忽略的轉換項目提供了轉型。 此功能被引入Qt的4.6 。 **See also** [itemAt](qgraphicsscene.html#itemAt)()和[Sorting](qgraphicsitem.html#sorting)。 ``` list-of-QGraphicsItem QGraphicsScene.items (self, float?x, float?y, float?w, float?h, Qt.ItemSelectionMode?mode?=?Qt.IntersectsItemShape) ``` 這是一個重載函數。 回報,這取決于所有可見項目_mode_,是內部或相交與指定_polygon_并返回一個列表排序的使用_order_。 為默認值_mode_ is [Qt.IntersectsItemShape](qt.html#ItemSelectionMode-enum);所有項目的確切形狀相交或包含由_polygon_返回。 _deviceTransform_是適用于該視圖,??并且需要如果場景中包含忽略的轉換項目提供了轉型。 此功能被引入Qt的4.6 。 **See also** [itemAt](qgraphicsscene.html#itemAt)()和[Sorting](qgraphicsitem.html#sorting)。 ``` list-of-QGraphicsItem QGraphicsScene.items (self, float?x, float?y, float?w, float?h, Qt.ItemSelectionMode?mode, Qt.SortOrder?order, QTransform?deviceTransform?=?QTransform()) ``` 這是一個重載函數。 回報,這取決于所有可見項目_mode_,是內部或相交與指定_path_并返回一個列表排序的使用_order_。 為默認值_mode_ is [Qt.IntersectsItemShape](qt.html#ItemSelectionMode-enum);所有項目的確切形狀相交或包含由_path_返回。 _deviceTransform_是適用于該視圖,??并且需要如果場景中包含忽略的轉換項目提供了轉型。 此功能被引入Qt的4.6 。 **See also** [itemAt](qgraphicsscene.html#itemAt)() and [Sorting](qgraphicsitem.html#sorting). ``` QRectF QGraphicsScene.itemsBoundingRect (self) ``` [ 計算并返回現場所有項目的邊界矩形。此功能通過遍歷所有項目,并且因為如果這一點,它可能會很慢的大場面。 ](qrectf.html) [**See also**](qrectf.html) [sceneRect](qgraphicsscene.html#sceneRect-prop)( ) 。 ``` QGraphicsScene.keyPressEvent (self, QKeyEvent?event) ``` 此事件處理程序,對于事件_keyEvent_,可重新實現在子類來接收按鍵事件。默認實現轉發事件到當前的重點項目。 **See also** [QGraphicsItem.keyPressEvent](qgraphicsitem.html#keyPressEvent)()和[focusItem](qgraphicsscene.html#focusItem)( ) 。 ``` QGraphicsScene.keyReleaseEvent (self, QKeyEvent?event) ``` 此事件處理程序,對于事件_keyEvent_,可重新實現在子類中接收鍵釋放事件。默認實現轉發事件到當前的重點項目。 **See also** [QGraphicsItem.keyReleaseEvent](qgraphicsitem.html#keyReleaseEvent)()和[focusItem](qgraphicsscene.html#focusItem)( ) 。 ``` QGraphicsScene.mouseDoubleClickEvent (self, QGraphicsSceneMouseEvent?event) ``` 此事件處理程序,對于事件_mouseEvent_,可重新實現在子類中接收鼠標雙擊事件現場。 如果有人在現場doubleclicks ,現場將先收到一個鼠標按下事件,隨后釋放事件(即點擊) ,然后雙擊事件,終于釋放事件。如果雙擊事件被傳遞到不同的項目比收到的第一個記者一個和釋放,這將作為一個新聞事件。然而, tripleclick事件不傳遞在這種情況下雙擊事件。 默認的實現是類似[mousePressEvent](qgraphicsscene.html#mousePressEvent)( ) 。 **See also** [QGraphicsItem.mousePressEvent](qgraphicsitem.html#mousePressEvent)( )[QGraphicsItem.mouseMoveEvent](qgraphicsitem.html#mouseMoveEvent)( )[QGraphicsItem.mouseReleaseEvent](qgraphicsitem.html#mouseReleaseEvent)()和[QGraphicsItem.setAcceptedMouseButtons](qgraphicsitem.html#setAcceptedMouseButtons)( ) 。 ``` QGraphicsItem QGraphicsScene.mouseGrabberItem (self) ``` [ 返回當前鼠標抓取物品,或者0,如果沒有項目目前正在抓住鼠標。鼠標采集卡產品接收發送到場景中的所有鼠標事件的項目。 一個項目變成了鼠標抓取,當它收到并接受鼠標按下事件,它保持鼠標采集卡,直到以下事件發生: * If the item receives a mouse release event when there are no other buttons pressed, it loses the mouse grab. * If the item becomes invisible (i.e., someone calls `item-&gt;setVisible(false)`), or if it becomes disabled (i.e., someone calls `item-&gt;setEnabled(false)`), it loses the mouse grab. * If the item is removed from the scene, it loses the mouse grab. 如果該項目失去了它的鼠標搶,現場將忽略所有的鼠標事件,直到一個新的項目抓起鼠標(即,直到一個新的項目接收鼠標按下事件) 。 ``` QGraphicsScene.mouseMoveEvent (self, QGraphicsSceneMouseEvent?event) ``` 此事件處理程序,對于事件_mouseEvent_,可重新實現在子類中接收鼠標移動事件的現場。 默認的實現依賴于鼠標抓取狀態。如果有一個鼠標采集項目時,事件被發送給小鼠采集。如果有接受懸停事件在當前位置的任何物品,該事件被轉化成一個懸停事件和接受,否則它忽略。 ](qgraphicsitem.html) [**See also**](qgraphicsitem.html) [QGraphicsItem.mousePressEvent](qgraphicsitem.html#mousePressEvent)( )[QGraphicsItem.mouseReleaseEvent](qgraphicsitem.html#mouseReleaseEvent)( )[QGraphicsItem.mouseDoubleClickEvent](qgraphicsitem.html#mouseDoubleClickEvent)()和[QGraphicsItem.setAcceptedMouseButtons](qgraphicsitem.html#setAcceptedMouseButtons)( ) 。 ``` QGraphicsScene.mousePressEvent (self, QGraphicsSceneMouseEvent?event) ``` 此事件處理程序,對于事件_mouseEvent_,可重新實現在子類中接收鼠標按下事件現場。 默認的實現依賴于場景的狀態。如果有一個鼠標采集卡產品,然后該事件被發送給小鼠采集。否則,它被轉發到接受鼠標事件從事件現場位置的最上方項目,而該項目迅速成為鼠標抓取物品。 如果沒有項目在現場給定的位置,選擇區域被重置,所有重點項目失去了輸入焦點,而該事件隨后被忽略。 **See also** [QGraphicsItem.mousePressEvent](qgraphicsitem.html#mousePressEvent)()和[QGraphicsItem.setAcceptedMouseButtons](qgraphicsitem.html#setAcceptedMouseButtons)( ) 。 ``` QGraphicsScene.mouseReleaseEvent (self, QGraphicsSceneMouseEvent?event) ``` 此事件處理程序,對于事件_mouseEvent_,可重新實現在子類中接收鼠標釋放事件的現場。 默認的實現依賴于鼠標抓取狀態。如果沒有鼠標采集卡,該事件將被忽略。否則,如果有一個鼠標采集項目時,事件被發送給小鼠采集。如果這個鼠標釋放代表鼠標上的最后按下按鈕,鼠標采集項目,然后失去鼠標搶。 **See also** [QGraphicsItem.mousePressEvent](qgraphicsitem.html#mousePressEvent)( )[QGraphicsItem.mouseMoveEvent](qgraphicsitem.html#mouseMoveEvent)( )[QGraphicsItem.mouseDoubleClickEvent](qgraphicsitem.html#mouseDoubleClickEvent)()和[QGraphicsItem.setAcceptedMouseButtons](qgraphicsitem.html#setAcceptedMouseButtons)( ) 。 ``` QPalette QGraphicsScene.palette (self) ``` [ ``` QGraphicsScene.removeItem (self, QGraphicsItem?item) ``` 該_item_爭論 ](qpalette.html) [刪除的項目_item_而從現場的所有兒童。所有權_item_被傳遞給調用者(即](qpalette.html)[QGraphicsScene](qgraphicsscene.html)將不再刪除_item_銷毀時) 。 **See also** [addItem](qgraphicsscene.html#addItem)( ) 。 ``` QGraphicsScene.render (self, QPainter?painter, QRectF?target?=?QRectF(), QRectF?source?=?QRectF(), Qt.AspectRatioMode?mode?=?Qt.KeepAspectRatio) ``` 呈現_source_從現場到RECT_target_,使用_painter_。此功能可用于捕捉場景的內容到一個繪圖設備,如一個有用的[QImage](qimage.html)(例如,采取截圖) ,或與印刷[QPrinter](qprinter.html)。例如: ``` [QGraphicsScene](qgraphicsscene.html) scene; scene.addItem(... ... [QPrinter](qprinter.html) printer([QPrinter](qprinter.html).HighResolution); printer.setPaperSize([QPrinter](qprinter.html).A4); [QPainter](qpainter.html) painter(&printer); scene.render(&painter); ``` If _source_是一個空矩形,該函數將使用[sceneRect](qgraphicsscene.html#sceneRect-prop)()來確定要呈現什么。如果_target_是一個空矩形,的尺寸_painter_的繪圖設備將被使用。 矩形內容源將根據待轉化_aspectRatioMode_以適應目標矩形。默認情況下,縱橫比蒙了,_source_縮放以適合_target_。 **See also** [QGraphicsView.render](qgraphicsview.html#render)( ) 。 ``` QRectF QGraphicsScene.sceneRect (self) ``` [ ``` list-of-QGraphicsItem QGraphicsScene.selectedItems (self) ``` 將返回所有當前選定項的列表。該項目在沒有特定的順序返回。 ](qrectf.html) [**See also**](qrectf.html) [setSelectionArea](qgraphicsscene.html#setSelectionArea)( ) 。 ``` QPainterPath QGraphicsScene.selectionArea (self) ``` [](qpainterpath.html) [返回先前設置的選擇區域](qpainterpath.html)[setSelectionArea](qgraphicsscene.html#setSelectionArea)( ) ,或空[QPainterPath](qpainterpath.html)如果沒有選擇區域已設置。 **See also** [setSelectionArea](qgraphicsscene.html#setSelectionArea)( ) 。 ``` bool QGraphicsScene.sendEvent (self, QGraphicsItem?item, QEvent?event) ``` 發送事件_event_項_item_可以通過事件過濾器。 只有當項目被勾選的情況下被發送。 Returns `false`如果事件已被過濾或如果該項目被禁用。否則返回從事件處理程序返回的值。 此功能被引入Qt的4.6 。 **See also** [QGraphicsItem.sceneEvent](qgraphicsitem.html#sceneEvent)()和[QGraphicsItem.sceneEventFilter](qgraphicsitem.html#sceneEventFilter)( ) 。 ``` QGraphicsScene.setActivePanel (self, QGraphicsItem?item) ``` 激活_item_,它必須是在這個場景中的項目。您也可以通過0_item_在這種情況下[QGraphicsScene](qgraphicsscene.html)將停用任何當前活動面板。 如果場景是目前處于非活動狀態,_item_保持非活動狀態,直到現場被激活(或IR_item_為0 ,沒有任何產品將被激活) 。 此功能被引入Qt的4.6 。 **See also** [activePanel](qgraphicsscene.html#activePanel)( )[isActive](qgraphicsscene.html#isActive)()和[QGraphicsItem.isActive](qgraphicsitem.html#isActive)( ) 。 ``` QGraphicsScene.setActiveWindow (self, QGraphicsWidget?widget) ``` 激活_widget_,它必須是在這個場景中的小部件。您也可以通過0_widget_在這種情況下[QGraphicsScene](qgraphicsscene.html)將停用任何當前活動窗口。 此功能被引入Qt的4.4 。 **See also** [activeWindow](qgraphicsscene.html#activeWindow)()和[QGraphicsWidget.isActiveWindow](qgraphicswidget.html#isActiveWindow)( ) 。 ``` QGraphicsScene.setBackgroundBrush (self, QBrush?brush) ``` ``` QGraphicsScene.setBspTreeDepth (self, int?depth) ``` ``` QGraphicsScene.setFocus (self, Qt.FocusReason?focusReason?=?Qt.OtherFocusReason) ``` 將焦點設置在現場通過發送[QFocusEvent](qfocusevent.html)到了現場,經過_focusReason_作為原因。如果場景早先失去它,而一個項目具有焦點后重新獲得焦點,最后的重點項目將獲得焦點與_focusReason_作為原因。 如果場景已經成為焦點,此函數什么都不做。 **See also** [hasFocus](qgraphicsscene.html#hasFocus)( )[clearFocus](qgraphicsscene.html#clearFocus)()和[setFocusItem](qgraphicsscene.html#setFocusItem)( ) 。 ``` QGraphicsScene.setFocusItem (self, QGraphicsItem?item, Qt.FocusReason?focusReason?=?Qt.OtherFocusReason) ``` 設置場景的重點項目_item_,重點原因_focusReason_,從可能有焦點以往任何物品取出后焦點。 If _item_是0 ,或者如果它要么不接受焦點(即,它不具有[QGraphicsItem.ItemIsFocusable](qgraphicsitem.html#GraphicsItemFlag-enum)標志啟用) ,或者是不可見的或不啟用,該功能只刪除焦點由以往任何focusitem 。 如果產品不為0 ,場面目前沒有焦點(即,[hasFocus](qgraphicsscene.html#hasFocus)( )返回False ) ,這個函數會調用[setFocus](qgraphicsscene.html#setFocus)(自動) 。 **See also** [focusItem](qgraphicsscene.html#focusItem)( )[hasFocus](qgraphicsscene.html#hasFocus)()和[setFocus](qgraphicsscene.html#setFocus)( ) 。 ``` QGraphicsScene.setFont (self, QFont?font) ``` ``` QGraphicsScene.setForegroundBrush (self, QBrush?brush) ``` ``` QGraphicsScene.setItemIndexMethod (self, ItemIndexMethod?method) ``` ``` QGraphicsScene.setPalette (self, QPalette?palette) ``` ``` QGraphicsScene.setSceneRect (self, QRectF?rect) ``` ``` QGraphicsScene.setSceneRect (self, float?x, float?y, float?w, float?h) ``` ``` QGraphicsScene.setSelectionArea (self, QPainterPath?path, QTransform?deviceTransform) ``` 設置選擇區域_path_。在此區域內的所有項目會立即選中,所有項目外均為Unselected 。你可以通過調用獲取所有選定的項目清單[selectedItems](qgraphicsscene.html#selectedItems)( ) 。 _deviceTransform_是適用于該視圖,??并且需要如果場景中包含忽略的轉換項目提供了轉型。 為一個項目被選中,它必須被標記為_selectable_([QGraphicsItem.ItemIsSelectable](qgraphicsitem.html#GraphicsItemFlag-enum)) 。 此功能被引入Qt的4.6 。 **See also** [clearSelection](qgraphicsscene.html#clearSelection)()和[selectionArea](qgraphicsscene.html#selectionArea)( ) 。 ``` QGraphicsScene.setSelectionArea (self, QPainterPath?path) ``` ``` QGraphicsScene.setSelectionArea (self, QPainterPath?path, Qt.ItemSelectionMode) ``` ``` QGraphicsScene.setSelectionArea (self, QPainterPath?path, Qt.ItemSelectionMode?mode, QTransform?deviceTransform) ``` 這是一個重載函數。 設置選擇區域_path_ using _mode_以確定數據項都包含在選擇的區域。 _deviceTransform_是適用于該視圖,??并且需要如果場景中包含忽略的轉換項目提供了轉型。 此功能被引入Qt的4.6 。 **See also** [clearSelection](qgraphicsscene.html#clearSelection)()和[selectionArea](qgraphicsscene.html#selectionArea)( ) 。 ``` QGraphicsScene.setSortCacheEnabled (self, bool?enabled) ``` ``` QGraphicsScene.setStickyFocus (self, bool?enabled) ``` ``` QGraphicsScene.setStyle (self, QStyle?style) ``` 該_style_說法有它的所有權轉移給Qt的。 設置或替換場景的風格_style_和reparents的風格了這一幕。任何先前分配的風格被刪除。場景的風格默認為[QApplication.style](qapplication.html#style)( ) ,并作為默認為全部[QGraphicsWidget](qgraphicswidget.html)場景中的項目。 改變風格,無論是直接通過調用調用這個函數,或間接[QApplication.setStyle](qapplication.html#setStyle)( ) ,會自動更新樣式場景中的所有部件沒有明確分配給他們的風格。 If _style_為0時,[QGraphicsScene](qgraphicsscene.html)將恢復到[QApplication.style](qapplication.html#style)( ) 。 此功能被引入Qt的4.4 。 **See also** [style](qgraphicsscene.html#style)( ) 。 ``` bool QGraphicsScene.stickyFocus (self) ``` ``` QStyle QGraphicsScene.style (self) ``` [](qstyle.html) [返回場景的風格,還是一樣](qstyle.html)[QApplication.style](qapplication.html#style)( )如果場景沒有被明確指定的樣式。 此功能被引入Qt的4.4 。 **See also** [setStyle](qgraphicsscene.html#setStyle)( ) 。 ``` QGraphicsScene.update (self, QRectF?rect?=?QRectF()) ``` 這種方法也是一個Qt槽與C + +的簽名`void update(const QRectF& = QRectF())`。 調度區域的重繪_rect_在現場。 **See also** [sceneRect](qgraphicsscene.html#sceneRect-prop)()和[changed](qgraphicsscene.html#changed)( ) 。 ``` QGraphicsScene.update (self, float?x, float?y, float?w, float?h) ``` 這是一個重載函數。 此功能相當于調用update ([QRectF](qrectf.html)(_x_,_y_,_w_,_h_)); 此功能被引入Qt的4.3 。 ``` list-of-QGraphicsView QGraphicsScene.views (self) ``` 返回的所有顯示這一幕的視圖的列表。 **See also** [QGraphicsView.scene](qgraphicsview.html#scene)( ) 。 ``` QGraphicsScene.wheelEvent (self, QGraphicsSceneWheelEvent?event) ``` 此事件處理程序,對于事件_wheelEvent_,可重新實現在子類中接收鼠標滾輪事件的現場。 默認情況下,該事件被光標下傳遞到最上面的可見項目。如果置之不理,事件傳播到項目之下,并再次,直到事件被接受,或到達現場。如果沒有任何項目接受的情況下,它會被忽略。 **See also** [QGraphicsItem.wheelEvent](qgraphicsitem.html#wheelEvent)( ) 。 ``` float QGraphicsScene.width (self) ``` 這個方便的功能等同于調用[sceneRect](qgraphicsscene.html#sceneRect-prop)( ) ,寬( ) 。 **See also** [height](qgraphicsscene.html#height)( ) 。 * * * ## Qt Signal Documentation ``` void changed (const QList<QRectF>&) ``` 這是該信號的默認超載。 這個信號是由發射[QGraphicsScene](qgraphicsscene.html)當控制到達事件循環,如果場景內容的變化。該_region_參數包含場景的矩形,表明已經改變了該地區的名單。 **See also** [QGraphicsView.updateScene](qgraphicsview.html#updateScene)( ) 。 ``` void sceneRectChanged (const QRectF&) ``` 這是該信號的默認超載。 這個信號是由發射[QGraphicsScene](qgraphicsscene.html)每當現場RECT變化。該_rect_參數是新場景的矩形。 **See also** [QGraphicsView.updateSceneRect](qgraphicsview.html#updateSceneRect)( ) 。 ``` void selectionChanged () ``` 這是該信號的默認超載。 這個信號是由發射[QGraphicsScene](qgraphicsscene.html)只要選擇發生改變。您可以致電[selectedItems](qgraphicsscene.html#selectedItems)()來獲取選定項的新列表。 當一個項目被選中或取消選擇,一個選擇區域設置,清除或以其他方式改變時,如果預先選擇的項目被添加到場景中,或者如果選擇的項目是從場景中刪除的選擇改變。 [QGraphicsScene](qgraphicsscene.html)為組選擇操作發出這個信號只有一次。例如,如果你設置一個選擇區域,選擇或取消選擇[QGraphicsItemGroup](qgraphicsitemgroup.html),或者如果您添加或從場景中刪除包含多個選定項目的SelectionChanged ( )是(每個項目,而不是一次)發出只有一次操作完成后,一個父項。 此功能被引入Qt的4.3 。 **See also** [setSelectionArea](qgraphicsscene.html#setSelectionArea)( )[selectedItems](qgraphicsscene.html#selectedItems)()和[QGraphicsItem.setSelected](qgraphicsitem.html#setSelected)( ) 。
                  <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>

                              哎呀哎呀视频在线观看