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

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # QGraphicsEffect Class Reference ## [[QtGui](index.htm) module] 該QGraphicsEffect類是所有圖形效果的基類。[More...](#details) 繼承[QObject](qobject.html)。 通過繼承[QGraphicsBlurEffect](qgraphicsblureffect.html),[QGraphicsColorizeEffect](qgraphicscolorizeeffect.html),[QGraphicsDropShadowEffect](qgraphicsdropshadoweffect.html)和[QGraphicsOpacityEffect](qgraphicsopacityeffect.html)。 ### Types * `enum ChangeFlag { SourceAttached, SourceDetached, SourceBoundingRectChanged, SourceInvalidated }` * `class **[ChangeFlags](index.htm)**` * `enum PixmapPadMode { NoPad, PadToTransparentBorder, PadToEffectiveBoundingRect }` ### Methods * `__init__ (self, QObject?parent?=?None)` * `QRectF boundingRect (self)` * `QRectF boundingRectFor (self, QRectF?sourceRect)` * `draw (self, QPainter?painter)` * `drawSource (self, QPainter?painter)` * `bool isEnabled (self)` * `setEnabled (self, bool?enable)` * `QRectF sourceBoundingRect (self, Qt.CoordinateSystem?system?=?Qt.LogicalCoordinates)` * `sourceChanged (self, ChangeFlags?flags)` * `bool sourceIsPixmap (self)` * `(QPixmap, QPoint?offset) sourcePixmap (self, Qt.CoordinateSystem?system?=?Qt.LogicalCoordinates, PixmapPadMode?mode?=?QGraphicsEffect.PadToEffectiveBoundingRect)` * `update (self)` * `updateBoundingRect (self)` ### Qt Signals * `void enabledChanged (bool)` * * * ## Detailed Description 該QGraphicsEffect類是所有圖形效果的基類。 效果改變元素掛接到渲染管線和源(例如,一個操作之間的外觀[QGraphicsPixmapItem](qgraphicspixmapitem.html))和目標設備(例如,[QGraphicsView](qgraphicsview.html)的視口) 。效果可以通過調用setEnabled (??假)被禁用。如果效果被禁用,源直接呈現。 要添加一個視覺效果的[QGraphicsItem](qgraphicsitem.html)例如,您可以使用一個標準的影響,或交替,通過創建QGraphicsEffect的子類創建自己的效果。關于該項目的使用效果可以被安裝[QGraphicsItem.setGraphicsEffect](qgraphicsitem.html#setGraphicsEffect)( ) 。 Qt提供了以下標準的影響: * [QGraphicsBlurEffect](qgraphicsblureffect.html) - blurs the item by a given radius * [QGraphicsDropShadowEffect](qgraphicsdropshadoweffect.html) - renders a dropshadow behind the item * [QGraphicsColorizeEffect](qgraphicscolorizeeffect.html) - renders the item in shades of any given color * [QGraphicsOpacityEffect](qgraphicsopacityeffect.html) - renders the item with an opacity | ![](https://img.kancloud.cn/c4/b0/c4b063c4ee3f35ab77e59379f99dd964_320x195.png) | | ![](https://img.kancloud.cn/6f/9d/6f9d59a5201a5400be5644d72afdd826_320x195.png) | ![](https://img.kancloud.cn/5b/1a/5b1a04cf19f52e84f251a4a5cd9b2fcf_320x195.png) | | ![](https://img.kancloud.cn/6f/98/6f988d142a889a80f9a8e3dfdcd23f34_320x195.png) | ![](https://img.kancloud.cn/93/87/93877a60de3e3843fbe094d9b0b1fdb5_320x195.png) | ![](https://img.kancloud.cn/67/d9/67d9d8a4127dc5628a3ff87584dd77b0_412x354.png) 有關如何使用每種效果的更多信息,請參見具體效果的文檔。 要創建自己的自定義效果,創造QGraphicsEffect (或任何其他現有效果)的一個子類,并重新實現虛函數[draw](qgraphicseffect.html#draw)( ) 。這個函數被調用時的效果需要重繪。該[draw](qgraphicseffect.html#draw)( )函數將畫家與畫作為參數。欲了解更多信息,請參閱documenation的[draw](qgraphicseffect.html#draw)( ) 。在[draw](qgraphicseffect.html#draw)( )函數可以調用[sourcePixmap](qgraphicseffect.html#sourcePixmap)( )來獲得圖形效果的源,然后可以處理的像素圖。 如果你的效果變化,使用[update](qgraphicseffect.html#update)()來請求重繪。如果您的自定義效果改變源的邊界矩形,例如,徑向發光效果可能需要申請額外的保證金,您可以重新實現虛[boundingRectFor](qgraphicseffect.html#boundingRectFor)( )函數,并調用[updateBoundingRect](qgraphicseffect.html#updateBoundingRect)( )通知框架每當這個矩形的變化。虛擬[sourceChanged](qgraphicseffect.html#sourceChanged)( )函數被調用以通知的影響,源已經以某種方式改變 - 例如,如果源是一個[QGraphicsRectItem](qgraphicsrectitem.html)其矩形的參數發生了變化。 * * * ## Type Documentation ``` QGraphicsEffect.ChangeFlag ``` 這個枚舉變量描述了在QGraphicsEffectSource發生了變化。 | Constant | Value | Description | | --- | --- | --- | | `QGraphicsEffect.SourceAttached` | `0x1` | 效果是安裝在一個源。 | | `QGraphicsEffect.SourceDetached` | `0x2` | 效果被卸載的來源。 | | `QGraphicsEffect.SourceBoundingRectChanged` | `0x4` | 源的邊界矩形已經改變。 | | `QGraphicsEffect.SourceInvalidated` | `0x8` | 源的視覺外觀已經改變。 | 該ChangeFlags類型是一個typedef為[QFlags](index.htm)\u003cChangeFlag\u003e 。它存儲ChangeFlag值的或組合。 ``` QGraphicsEffect.PixmapPadMode ``` 這個枚舉變量描述了如何從sourcePixmap返回的像素圖會被填充。 | Constant | Value | Description | | --- | --- | --- | | `QGraphicsEffect.NoPad` | `0` | 像素圖不應該接受任何額外的填充。 | | `QGraphicsEffect.PadToTransparentBorder` | `1` | 像素圖會被填充,以確保它有一個完全透明的邊框。 | | `QGraphicsEffect.PadToEffectiveBoundingRect` | `2` | 像素圖會被填充,以配合效果的有效邊界矩形。 | * * * ## Method Documentation ``` QGraphicsEffect.__init__ (self, QObject?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個新的[QGraphicsEffect](qgraphicseffect.html)經指定的實例_parent_。 ``` QRectF QGraphicsEffect.boundingRect (self) ``` [ 返回的有效邊界矩形這種效果,即在設備坐標源的邊界矩形,由效果本身應用的任何利潤調整。 ](qrectf.html) [**See also**](qrectf.html) [boundingRectFor](qgraphicseffect.html#boundingRectFor)()和[updateBoundingRect](qgraphicseffect.html#updateBoundingRect)( ) 。 ``` QRectF QGraphicsEffect.boundingRectFor (self, QRectF?sourceRect) ``` [](qrectf.html) [返回有效邊界矩形這樣的效果,給出了提供_rect_在設備的坐標。當你編寫自己的自定義效果,你必須調用](qrectf.html)[updateBoundingRect](qgraphicseffect.html#updateBoundingRect)( )每當任何參數發生改變,可能會導致這個這個函數返回一個不同的值。 **See also** [sourceBoundingRect](qgraphicseffect.html#sourceBoundingRect)( ) 。 ``` QGraphicsEffect.draw (self, QPainter?painter) ``` 這種方法是抽象的,應在任何子類中重新實現。 這個純虛函數繪制的效果,被稱為每當源需要被繪制。 在重新實現這個函數[QGraphicsEffect](qgraphicseffect.html)子類提供的效果的繪圖實現,用_painter_。 例如: ``` MyGraphicsEffect.draw([QPainter](qpainter.html) *painter) { ... [QPoint](qpoint.html) offset; if (sourceIsPixmap()) { // No point in drawing in device coordinates (pixmap will be scaled anyways). const [QPixmap](qpixmap.html) pixmap = sourcePixmap([Qt](qt.html).LogicalCoordinates, &offset); ... painter->drawPixmap(offset, pixmap); } else { // Draw pixmap in device coordinates to avoid pixmap scaling; const [QPixmap](qpixmap.html) pixmap = sourcePixmap([Qt](qt.html).DeviceCoordinates, &offset); painter->setWorldTransform([QTransform](qtransform.html)()); ... painter->drawPixmap(offset, pixmap); } ... } ``` 這個函數不應該顯式調用的用戶,因為它的意思是只重新實現的目的。 ``` QGraphicsEffect.drawSource (self, QPainter?painter) ``` 繪制源直接使用給定的_painter_。 此功能只能由被稱為[QGraphicsEffect.draw](qgraphicseffect.html#draw)( ) 。 例如: ``` MyGraphicsOpacityEffect.draw([QPainter](qpainter.html) *painter) { // Fully opaque; draw directly without going through a pixmap. if (qFuzzyCompare(m_opacity, 1)) { drawSource(painter); return; } ... } ``` **See also** [QGraphicsEffect.draw](qgraphicseffect.html#draw)( ) 。 ``` bool QGraphicsEffect.isEnabled (self) ``` ``` QGraphicsEffect.setEnabled (self, bool?enable) ``` 這種方法也是一個Qt槽與C + +的簽名`void setEnabled(bool)`。 ``` QRectF QGraphicsEffect.sourceBoundingRect (self, Qt.CoordinateSystem?system?=?Qt.LogicalCoordinates) ``` [ 返回源映射到給定的邊界矩形_system_。 ](qrectf.html) [調用此函數](qrectf.html)[Qt.DeviceCoordinates](qt.html#CoordinateSystem-enum)外[QGraphicsEffect.draw](qgraphicseffect.html#draw)( )將給不確定的結果,因為沒有可用的設備上下文。 **See also** [draw](qgraphicseffect.html#draw)( ) 。 ``` QGraphicsEffect.sourceChanged (self, ChangeFlags?flags) ``` 這個虛函數被調用[QGraphicsEffect](qgraphicseffect.html)以通知源發生了變化的影響。如果效果適用于任何高速緩存,那么該緩存必須以反映源的全新亮相清除。 該_flags_描述發生了什么變化。 ``` bool QGraphicsEffect.sourceIsPixmap (self) ``` 返回True如果源有效地為一個像素映射,例如,一個[QGraphicsPixmapItem](qgraphicspixmapitem.html)。 此功能可用于優化目的。舉例來說,有沒有點繪制在設備中的源坐標,以避免像素圖的縮放,如果這個函數返回True - 源像素圖將反正縮放。 ``` (QPixmap, QPoint?offset) QGraphicsEffect.sourcePixmap (self, Qt.CoordinateSystem?system?=?Qt.LogicalCoordinates, PixmapPadMode?mode?=?QGraphicsEffect.PadToEffectiveBoundingRect) ``` 返回一個像素圖,畫到它的來源。 該_system_指定了坐標系也可以用于源。可選的_offset_返回參數的偏移,其中像素圖應使用當前的畫家來畫。有關如何在像素圖是填充用的控制_mode_參數。 返回的像素圖剪切到當前畫家的設備時,矩形_system_ is [Qt.DeviceCoordinates](qt.html#CoordinateSystem-enum)。 調用此函數[Qt.DeviceCoordinates](qt.html#CoordinateSystem-enum)外[QGraphicsEffect.draw](qgraphicseffect.html#draw)( )將給不確定的結果,因為沒有可用的設備上下文。 **See also** [draw](qgraphicseffect.html#draw)()和[boundingRect](qgraphicseffect.html#boundingRect)( ) 。 ``` QGraphicsEffect.update (self) ``` 這種方法也是一個Qt槽與C + +的簽名`void update()`。 附表的效果重繪。調用此函數時的效果需要重新繪制。該功能不會觸發源的重繪。 **See also** [updateBoundingRect](qgraphicseffect.html#updateBoundingRect)( ) 。 ``` QGraphicsEffect.updateBoundingRect (self) ``` 該函數通知影響的框架時,效果的邊界矩形已經改變。作為一個自定義效果的作者,你必須調用這個函數,每當您更改任何參數,將導致虛擬[boundingRectFor](qgraphicseffect.html#boundingRectFor)( )函數返回一個不同的值。 這個函數會調用[update](qgraphicseffect.html#update)( )如果這是必要的。 **See also** [boundingRectFor](qgraphicseffect.html#boundingRectFor)( )[boundingRect](qgraphicseffect.html#boundingRect)()和[sourceBoundingRect](qgraphicseffect.html#sourceBoundingRect)( ) 。 * * * ## Qt Signal Documentation ``` void enabledChanged (bool) ``` 這是該信號的默認超載。 每當效果是啟用或禁用該信號被發射。該_enabled_參數保存效果的新啟用的狀態。 **See also** [isEnabled](qgraphicseffect.html#enabled-prop)( ) 。
                  <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>

                              哎呀哎呀视频在线观看