<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之旅 廣告
                # QGraphicsLayout Class Reference ## [[QtGui](index.htm) module] 該QGraphicsLayout類提供了所有布局的基類的圖形視圖。[More...](#details) 繼承[QGraphicsLayoutItem](qgraphicslayoutitem.html)。 通過繼承[QGraphicsAnchorLayout](qgraphicsanchorlayout.html),[QGraphicsGridLayout](qgraphicsgridlayout.html)和[QGraphicsLinearLayout](qgraphicslinearlayout.html)。 ### Methods * `__init__ (self, QGraphicsLayoutItem?parent?=?None)` * `activate (self)` * `addChildLayoutItem (self, QGraphicsLayoutItem?layoutItem)` * `int count (self)` * `(float?left, float?top, float?right, float?bottom) getContentsMargins (self)` * `invalidate (self)` * `bool isActivated (self)` * `QGraphicsLayoutItem itemAt (self, int?i)` * `removeAt (self, int?index)` * `setContentsMargins (self, float?left, float?top, float?right, float?bottom)` * `updateGeometry (self)` * `widgetEvent (self, QEvent?e)` ### Special Methods * `__len__ (self)` * * * ## Detailed Description 該QGraphicsLayout類提供了所有布局的基類的圖形視圖。 QGraphicsLayout是定義一個虛擬的API,用于安排一個抽象類[QGraphicsWidget](qgraphicswidget.html)兒童和其他[QGraphicsLayoutItem](qgraphicslayoutitem.html)一個對象[QGraphicsWidget](qgraphicswidget.html)。[QGraphicsWidget](qgraphicswidget.html)通過分配責任到QGraphicsLayout[QGraphicsWidget.setLayout](qgraphicswidget.html#layout-prop)( ) 。由于小部件的大小時,布局會自動排列窗口部件的孩子。 QGraphicsLayout繼承[QGraphicsLayoutItem](qgraphicslayoutitem.html),因此,它可以由任何布局,包括其自己的子類來管理。 ### Writing a Custom Layout 您可以使用QGraphicsLayout為基礎編寫自己的自定義布局(例如,一個的FlowLayout ) ,但更常見的是使用它的子類而不是一個 - [QGraphicsLinearLayout](qgraphicslinearlayout.html) or [QGraphicsGridLayout](qgraphicsgridlayout.html)。當創建一個自定義布局,下面的函數必須重新實現一個最低限度: | Function | Description | | --- | --- | | [QGraphicsLayoutItem.setGeometry](qgraphicslayoutitem.html#setGeometry)() | Notifies you when the geometry of the layout is set. You can store the geometry in your own layout class in a reimplementation of this function. | | [QGraphicsLayoutItem.sizeHint](qgraphicslayoutitem.html#sizeHint)() | Returns the layout's size hints. | | [QGraphicsLayout.count](qgraphicslayout.html#count)() | Returns the number of items in your layout. | | [QGraphicsLayout.itemAt](qgraphicslayout.html#itemAt)() | Returns a pointer to an item in your layout. | | [QGraphicsLayout.removeAt](qgraphicslayout.html#removeAt)() | Removes an item from your layout without destroying it. | 有關如何實現每個功能的詳細信息,請參閱單獨的函數文檔。 每個布局定義了自己的API來安排組件和布局的項目。例如,一個網格布局,則需要一個行和可選的行和列跨度,對齊,間距和多列索引。線性布局,但是,需要一個單一的行或列的索引來定位它的項目。為網格布局,插入順序不影響布局以任何方式,但對于一個線性布局,順序是至關重要的。當寫你自己的布局的子類,你可以自由選擇最適合你的布局的API 。 對于新增項目布局到自定義布局, QGraphicsLayout提供了便利的功能[addChildLayoutItem](qgraphicslayout.html#addChildLayoutItem)( ) 。該功能將自動重定父級的圖形項目護理,如果需要的話。 ### Activating the Layout 當布局的幾何變化, QGraphicsLayout立即致電重新排列所有的管理項目[setGeometry](qgraphicslayoutitem.html#setGeometry)( )上的每個項目。此重排被稱為_activating_的布局。 QGraphicsLayout更新它自己的幾何形狀,以匹配[contentsRect](qgraphicslayoutitem.html#contentsRect)()的[QGraphicsLayoutItem](qgraphicslayoutitem.html)它是管理。因此,它會自動重新安排所有項目時,窗口小部件大小調整。 QGraphicsLayout緩存其所有的管理項目的大小,以避免調用[setGeometry](qgraphicslayoutitem.html#setGeometry)( )過于頻繁。 **Note:**一個QGraphicsLayout將具有相同幾何形狀的[contentsRect](qgraphicslayoutitem.html#contentsRect)()窗口小部件(未布局)它被分配給。 #### Activating the Layout Implicitly 該布局可以隱式地使用以下兩種方式之一來激活:通過調用[activate](qgraphicslayout.html#activate)( )或致電[invalidate](qgraphicslayout.html#invalidate)( ) 。調用[activate](qgraphicslayout.html#activate)( )立即啟動布局。與此相反,調用[invalidate](qgraphicslayout.html#invalidate)( )被延遲,因為它一個職位[LayoutRequest](qevent.html#Type-enum)事件給管理部件。由于事件壓縮,則[activate](qgraphicslayout.html#activate)( )只會被調用一次后,控制返回到事件循環。這被稱為_invalidating_的布局。無效的布局也是任何緩存信息失效。此外,該[invalidate](qgraphicslayout.html#invalidate)()函數是虛擬函數。所以,你可以通過重新實現該功能無效你自己的緩存中QGraphicsLayout的一個子類。 ### Event Handling QGraphicsLayout監聽事件管理它通過虛擬的小工具[widgetEvent](qgraphicslayout.html#widgetEvent)( )事件處理程序。當布局被分配到一個小部件,輸送到部件的所有事件首先被處理[widgetEvent](qgraphicslayout.html#widgetEvent)( ) 。這使得布局要注意的諸如可見性的變化或布局方向的變化在部件上的任何有關的狀態變化。 ### Margin Handling 一個QGraphicsLayout的利潤可以通過重新實現修改[setContentsMargins](qgraphicslayout.html#setContentsMargins)()和[getContentsMargins](qgraphicslayout.html#getContentsMargins)( ) 。 * * * ## Method Documentation ``` QGraphicsLayout.__init__ (self, QGraphicsLayoutItem?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 Contructs一個[QGraphicsLayout](qgraphicslayout.html)對象。 _parent_被傳遞給[QGraphicsLayoutItem](qgraphicslayoutitem.html)的構造函數和[QGraphicsLayoutItem](qgraphicslayoutitem.html)的isLayout參數設置為_true_。 If _parent_是[QGraphicsWidget](qgraphicswidget.html)的布局將被安裝在該部件。 (請注意,在安裝布局將刪除舊的安裝。 ) ``` QGraphicsLayout.activate (self) ``` 激活的布局,導致在布局的所有項目要立即重新排列。此功能是基于調用[count](qgraphicslayout.html#count)()和[itemAt](qgraphicslayout.html#itemAt)( ) ,然后調用[setGeometry](qgraphicslayoutitem.html#setGeometry)( )順序上的所有項目。當被激活時,該布局將其幾何形狀調整到它的父[contentsRect](qgraphicslayoutitem.html#contentsRect)( ) 。家長就會失效任何自己的布局。 如果按順序調用或遞歸,例如,通過在響應被調整的安排的項目之一,此功能不會做任何事。 注意,該布局可以自由地使用幾何緩存來優化這個過程。為了有力地違反對這樣的高速緩存,可以調用[invalidate](qgraphicslayout.html#invalidate)( )調用之前激活( ) 。 **See also** [invalidate](qgraphicslayout.html#invalidate)( ) 。 ``` QGraphicsLayout.addChildLayoutItem (self, QGraphicsLayoutItem?layoutItem) ``` 該_layoutItem_說法有它的所有權轉移給Qt的。 此功能提供了自定義布局一個方便的功能,并且將通過所有項目的布局和reparent他們的圖形項目,最接近[QGraphicsWidget](qgraphicswidget.html)祖先的布局。 If _layoutItem_已經在不同的布局,將被從該布局中移除。 如果自定義布局需要特殊的行為,他們可以忽略使用此功能,并實現自己的行為。 此功能被引入Qt的4.6 。 **See also** [graphicsItem](qgraphicslayoutitem.html#graphicsItem)( ) 。 ``` int QGraphicsLayout.count (self) ``` 這種方法是抽象的,應在任何子類中重新實現。 這個純虛函數必須在子類中重新實現[QGraphicsLayout](qgraphicslayout.html)返回在布局中的項目數。 子類可以自由地決定如何存儲的項目。 **See also** [itemAt](qgraphicslayout.html#itemAt)()和[removeAt](qgraphicslayout.html#removeAt)( ) 。 ``` (float?left, float?top, float?right, float?bottom) QGraphicsLayout.getContentsMargins (self) ``` 從重新實現[QGraphicsLayoutItem.getContentsMargins](qgraphicslayoutitem.html#getContentsMargins)( ) 。 ``` QGraphicsLayout.invalidate (self) ``` 清除布局中的任何緩存的幾何形狀和尺寸提示信息,職位[LayoutRequest](qevent.html#Type-enum)事件到管理的父[QGraphicsLayoutItem](qgraphicslayoutitem.html)。 **See also** [activate](qgraphicslayout.html#activate)()和[setGeometry](qgraphicslayoutitem.html#setGeometry)( ) 。 ``` bool QGraphicsLayout.isActivated (self) ``` 返回True如果布局是當前被激活,否則返回False 。如果布局被激活,這意味著它是目前在重排它的產品(即,過程中的[activate](qgraphicslayout.html#activate)( )函數被調用,并且還沒有恢復) 。 **See also** [activate](qgraphicslayout.html#activate)()和[invalidate](qgraphicslayout.html#invalidate)( ) 。 ``` QGraphicsLayoutItem QGraphicsLayout.itemAt (self, int?i) ``` [ 這種方法是抽象的,應在任何子類中重新實現。 ](qgraphicslayoutitem.html) [這個純虛函數必須在子類中重新實現](qgraphicslayoutitem.html)[QGraphicsLayout](qgraphicslayout.html)返回一個指針到了該項目的索引_i_。重新實現可以假設_i_是有效的(即,它尊重的值[count](qgraphicslayout.html#count)())。再加上[count](qgraphicslayout.html#count)(),它是作為遍歷所有項目在一個布局的一個手段。 子類可以自由地決定如何存儲的項目,和視覺的安排不必通過這個功能來體現。 **See also** [count](qgraphicslayout.html#count)()和[removeAt](qgraphicslayout.html#removeAt)( ) 。 ``` QGraphicsLayout.removeAt (self, int?index) ``` 這種方法是抽象的,應在任何子類中重新實現。 這個純虛函數必須在子類中重新實現[QGraphicsLayout](qgraphicslayout.html)到刪除的項_index_。重新實現可以假設_index_是有效的(即,它尊重的值[count](qgraphicslayout.html#count)())。 實施必須確保[parentLayoutItem](qgraphicslayoutitem.html#parentLayoutItem)已刪除的項目的( )并不指向這個布局,因為該項目被認為是從布局層次結構中移除。 如果布局是應用程序之間重復使用,我們建議布局中刪除的項目,但圖形視圖框架并不依賴于這一點。 子類可以自由地決定如何存儲的項目。 **See also** [itemAt](qgraphicslayout.html#itemAt)()和[count](qgraphicslayout.html#count)( ) 。 ``` QGraphicsLayout.setContentsMargins (self, float?left, float?top, float?right, float?bottom) ``` 設置的內容邊距_left_,_top_,_right_和_bottom_。默認的內容利潤率頂層布局風格依賴(通過查詢pixelMetric的[QStyle.PM_LayoutLeftMargin](qstyle.html#PixelMetric-enum),[QStyle.PM_LayoutTopMargin](qstyle.html#PixelMetric-enum),[QStyle.PM_LayoutRightMargin](qstyle.html#PixelMetric-enum)和[QStyle.PM_LayoutBottomMargin](qstyle.html#PixelMetric-enum)) 。 對于sublayouts默認頁邊距為0 。 變更內容自動邊距布局無效。 **See also** [invalidate](qgraphicslayout.html#invalidate)( ) 。 ``` QGraphicsLayout.updateGeometry (self) ``` 從重新實現[QGraphicsLayoutItem.updateGeometry](qgraphicslayoutitem.html#updateGeometry)( ) 。 ``` QGraphicsLayout.widgetEvent (self, QEvent?e) ``` 這種虛擬事件處理程序接收的管理部件的所有事件。[QGraphicsLayout](qgraphicslayout.html)使用此事件處理程序以偵聽布局相關的事件,如幾何形狀的變化,布局的變化或布局的方向變化。 _e_是一個指向該事件。 您可以重新實現此事件處理程序來跟蹤自己的自定義布局類似事件。 **See also** [QGraphicsWidget.event](qgraphicswidget.html#event)()和[QGraphicsItem.sceneEvent](qgraphicsitem.html#sceneEvent)( ) 。 ``` QGraphicsLayout.__len__ (self) ```
                  <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>

                              哎呀哎呀视频在线观看