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

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # QGraphicsWidget Class Reference ## [[QtGui](index.htm) module] 該QGraphicsWidget類是在所有部件項目的基類[QGraphicsScene](qgraphicsscene.html)。[More...](#details) 繼承[QGraphicsObject](qgraphicsobject.html)和[QGraphicsLayoutItem](qgraphicslayoutitem.html)。 通過繼承[QGraphicsProxyWidget](qgraphicsproxywidget.html)和[QGraphicsWebView](qgraphicswebview.html)。 ### Methods * `__init__ (self, QGraphicsItem?parent?=?None, Qt.WindowFlags?flags?=?0)` * `list-of-QAction actions (self)` * `addAction (self, QAction?action)` * `addActions (self, list-of-QAction?actions)` * `adjustSize (self)` * `bool autoFillBackground (self)` * `QRectF boundingRect (self)` * `changeEvent (self, QEvent?event)` * `bool close (self)` * `closeEvent (self, QCloseEvent?event)` * `bool event (self, QEvent?event)` * `focusInEvent (self, QFocusEvent?event)` * `bool focusNextPrevChild (self, bool?next)` * `focusOutEvent (self, QFocusEvent?event)` * `Qt.FocusPolicy focusPolicy (self)` * `QGraphicsWidget focusWidget (self)` * `QFont font (self)` * `(float?left, float?top, float?right, float?bottom) getContentsMargins (self)` * `(float?left, float?top, float?right, float?bottom) getWindowFrameMargins (self)` * `grabKeyboardEvent (self, QEvent?event)` * `grabMouseEvent (self, QEvent?event)` * `int grabShortcut (self, QKeySequence?sequence, Qt.ShortcutContext?context?=?Qt.WindowShortcut)` * `hideEvent (self, QHideEvent?event)` * `hoverLeaveEvent (self, QGraphicsSceneHoverEvent?event)` * `hoverMoveEvent (self, QGraphicsSceneHoverEvent?event)` * `initStyleOption (self, QStyleOption?option)` * `insertAction (self, QAction?before, QAction?action)` * `insertActions (self, QAction?before, list-of-QAction?actions)` * `bool isActiveWindow (self)` * `QVariant itemChange (self, QGraphicsItem.GraphicsItemChange?change, QVariant?value)` * `QGraphicsLayout layout (self)` * `Qt.LayoutDirection layoutDirection (self)` * `moveEvent (self, QGraphicsSceneMoveEvent?event)` * `paint (self, QPainter?painter, QStyleOptionGraphicsItem?option, QWidget?widget?=?None)` * `paintWindowFrame (self, QPainter?painter, QStyleOptionGraphicsItem?option, QWidget?widget?=?None)` * `QPalette palette (self)` * `polishEvent (self)` * `QRectF rect (self)` * `releaseShortcut (self, int?id)` * `removeAction (self, QAction?action)` * `resize (self, QSizeF?size)` * `resize (self, float?w, float?h)` * `resizeEvent (self, QGraphicsSceneResizeEvent?event)` * `bool sceneEvent (self, QEvent?event)` * `setAttribute (self, Qt.WidgetAttribute?attribute, bool?on?=?True)` * `setAutoFillBackground (self, bool?enabled)` * `setContentsMargins (self, float?left, float?top, float?right, float?bottom)` * `setFocusPolicy (self, Qt.FocusPolicy?policy)` * `setFont (self, QFont?font)` * `setGeometry (self, QRectF?rect)` * `setGeometry (self, float?ax, float?ay, float?aw, float?ah)` * `setLayout (self, QGraphicsLayout?layout)` * `setLayoutDirection (self, Qt.LayoutDirection?direction)` * `setPalette (self, QPalette?palette)` * `setShortcutAutoRepeat (self, int?id, bool?enabled?=?True)` * `setShortcutEnabled (self, int?id, bool?enabled?=?True)` * `setStyle (self, QStyle?style)` * `setWindowFlags (self, Qt.WindowFlags?wFlags)` * `setWindowFrameMargins (self, float?left, float?top, float?right, float?bottom)` * `setWindowTitle (self, QString?title)` * `QPainterPath shape (self)` * `showEvent (self, QShowEvent?event)` * `QSizeF size (self)` * `QSizeF sizeHint (self, Qt.SizeHint?which, QSizeF?constraint?=?QSizeF())` * `QStyle style (self)` * `bool testAttribute (self, Qt.WidgetAttribute?attribute)` * `int type (self)` * `ungrabKeyboardEvent (self, QEvent?event)` * `ungrabMouseEvent (self, QEvent?event)` * `unsetLayoutDirection (self)` * `unsetWindowFrameMargins (self)` * `updateGeometry (self)` * `Qt.WindowFlags windowFlags (self)` * `bool windowFrameEvent (self, QEvent?e)` * `QRectF windowFrameGeometry (self)` * `QRectF windowFrameRect (self)` * `Qt.WindowFrameSection windowFrameSectionAt (self, QPointF?pos)` * `QString windowTitle (self)` * `Qt.WindowType windowType (self)` ### Static Methods * `setTabOrder (QGraphicsWidget?first, QGraphicsWidget?second)` ### Qt Signals * `void geometryChanged ()` * * * ## Detailed Description 該QGraphicsWidget類是在所有部件項目的基類[QGraphicsScene](qgraphicsscene.html)。 QGraphicsWidget是一個擴展的基地項目,超過提供額外的功能[QGraphicsItem](qgraphicsitem.html)。它類似于[QWidget](qwidget.html)在很多方面: * Provides a [palette](qgraphicswidget.html#palette-prop), a [font](qgraphicswidget.html#font-prop) and a [style](qgraphicswidget.html#style)(). * Has a defined [geometry](qgraphicslayoutitem.html#geometry)(). * Supports layouts with [setLayout](qgraphicswidget.html#layout-prop)() and [layout](qgraphicswidget.html#layout-prop)(). * Supports shortcuts and actions with [grabShortcut](qgraphicswidget.html#grabShortcut)() and [insertAction](qgraphicswidget.html#insertAction)() 不像[QGraphicsItem](qgraphicsitem.html), QGraphicsWidget不是一個抽象類,你可以創建一個QGraphicsWidget的實例,而無需繼承它。這種方法對小部件,只有服務于構建子控件到布局的目的是有用的。 QGraphicsWidget如果您需要先進的輸入焦點的處理,例如,標籤對焦和激活,或布局被用來作為自己的自定義項目的基礎項目。 由于QGraphicsWidget酷似[QWidget](qwidget.html)并具有類似的API ,它更容易端口插件從[QWidget](qwidget.html)到QGraphicsWidget ,而不是[QGraphicsItem](qgraphicsitem.html)。 **Note:** [QWidget](qwidget.html)基于窗口小部件可以被直接嵌入到一個[QGraphicsScene](qgraphicsscene.html) using [QGraphicsProxyWidget](qgraphicsproxywidget.html)。 QGraphicsWidget之間明顯的差異[QWidget](qwidget.html)分別是: | QGraphicsWidget | [QWidget](qwidget.html) | | --- | --- | | Coordinates and geometry are defined with qreals (doubles or floats, depending on the platform). | [QWidget](qwidget.html) uses integer geometry ([QPoint](qpoint.html), [QRect](qrect.html)). | | The widget is already visible by default; you do not have to call [show](qgraphicsitem.html#show)() to display the widget. | [QWidget](qwidget.html) is hidden by default until you call [show](qgraphicsitem.html#show)(). | | A subset of widget attributes are supported. | All widget attributes are supported. | | A top-level item's style defaults to QGraphicsScene.style | A top-level widget's style defaults to QApplication.style | | Graphics View provides a custom drag and drop framework, different from [QWidget](qwidget.html). | Standard drag and drop framework. | | Widget items do not support modality. | Full modality support. | QGraphicsWidget支持Qt的窗口部件的屬性的一個子集, ([Qt.WidgetAttribute](qt.html#WidgetAttribute-enum))所示,在下表中。本表中未列出的任何屬性是不支持的,或以其他方式使用。 | Widget Attribute | Usage | | --- | --- | | [Qt.WA_SetLayoutDirection](qt.html#WidgetAttribute-enum) | Set by [setLayoutDirection](qgraphicswidget.html#layoutDirection-prop)(), cleared by [unsetLayoutDirection](qgraphicswidget.html#layoutDirection-prop)(). You can test this attribute to check if the widget has been explicitly assigned a [layoutDirection](qgraphicswidget.html#layoutDirection-prop). If the attribute is not set, the [layoutDirection()](qgraphicswidget.html#layoutDirection-prop) is inherited. | | [Qt.WA_RightToLeft](qt.html#WidgetAttribute-enum) | Toggled by [setLayoutDirection](qgraphicswidget.html#layoutDirection-prop)(). Inherited from the parent/scene. If set, the widget's layout will order horizontally arranged widgets from right to left. | | [Qt.WA_SetStyle](qt.html#WidgetAttribute-enum) | Set and cleared by [setStyle](qgraphicswidget.html#setStyle)(). If this attribute is set, the widget has been explicitly assigned a style. If it is unset, the widget will use the scene's or the application's style. | | [Qt.WA_Resized](qt.html#WidgetAttribute-enum) | Set by [setGeometry](qgraphicswidget.html#geometry-prop)() and [resize](qgraphicswidget.html#size-prop)(). | | [Qt.WA_SetPalette](qt.html#WidgetAttribute-enum) | Set by [setPalette](qgraphicswidget.html#palette-prop)(). | | [Qt.WA_SetFont](qt.html#WidgetAttribute-enum) | Set by [setFont](qgraphicswidget.html#font-prop)(). | | [Qt.WA_WindowPropagation](qt.html#WidgetAttribute-enum) | Enables propagation to window widgets. | 雖然QGraphicsWidget從兩個繼承[QObject](qobject.html)和[QGraphicsItem](qgraphicsitem.html),你應該使用所提供的功能[QGraphicsItem](qgraphicsitem.html),_not_ [QObject](qobject.html),管理父和子項之間的關系。這些功能控制項目的堆疊順序以及它們的所有權。 **Note:**該[QObject.parent](qobject.html#parent)( )應該總是返回0 QGraphicsWidgets ,但這項政策沒有嚴格的定義。 * * * ## Method Documentation ``` QGraphicsWidget.__init__ (self, QGraphicsItem?parent?=?None, Qt.WindowFlags?flags?=?0) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個[QGraphicsWidget](qgraphicswidget.html)實例。可選的_parent_參數被傳遞給[QGraphicsItem](qgraphicsitem.html)的構造。可選的_wFlags_參數指定了小部件的窗口標志(例如,小部件是否應該是一個窗口,一個工具,一個彈出式等) 。 ``` list-of-QAction QGraphicsWidget.actions (self) ``` 返回這個窗口部件的動作(可能為空)列表。 此功能被引入Qt的4.5 。 **See also** [insertAction](qgraphicswidget.html#insertAction)( )[removeAction](qgraphicswidget.html#removeAction)( )[QWidget.actions](qwidget.html#actions)( )[QAction.associatedWidgets](qaction.html#associatedWidgets)()和[QAction.associatedGraphicsWidgets](qaction.html#associatedGraphicsWidgets)( ) 。 ``` QGraphicsWidget.addAction (self, QAction?action) ``` 追加行動_action_以行動這個小工具的列表。 所有QGraphicsWidgets具有列表[QAction](qaction.html)秒,但是它們可以被以圖形方式在許多不同的方式來表示。在默認情況下使用的[QAction](qaction.html)列表(所返回[actions](qgraphicswidget.html#actions)())是創建一個上下文[QMenu](qmenu.html)。 A [QGraphicsWidget](qgraphicswidget.html)應該只有每個動作中的一個,并將其添加已經有一個操作不會導致相同的動作是在插件的兩倍。 此功能被引入Qt的4.5 。 **See also** [removeAction](qgraphicswidget.html#removeAction)( )[insertAction](qgraphicswidget.html#insertAction)( )[actions](qgraphicswidget.html#actions)()和[QWidget.addAction](qwidget.html#addAction)( ) 。 ``` QGraphicsWidget.addActions (self, list-of-QAction?actions) ``` 追加行動_actions_以行動這個小工具的列表。 此功能被引入Qt的4.5 。 **See also** [removeAction](qgraphicswidget.html#removeAction)( )[QMenu](qmenu.html),[addAction](qgraphicswidget.html#addAction)()和[QWidget.addActions](qwidget.html#addActions)( ) 。 ``` QGraphicsWidget.adjustSize (self) ``` 調整小部件的大小達到有效的首選大小的提示。 這個函數被調用時隱式的項目顯示的第一次。 **See also** [effectiveSizeHint](qgraphicslayoutitem.html#effectiveSizeHint)()和[Qt.MinimumSize](qt.html#SizeHint-enum)。 ``` bool QGraphicsWidget.autoFillBackground (self) ``` ``` QRectF QGraphicsWidget.boundingRect (self) ``` [](qrectf.html) [從重新實現](qrectf.html)[QGraphicsItem.boundingRect](qgraphicsitem.html#boundingRect)( ) 。 ``` QGraphicsWidget.changeEvent (self, QEvent?event) ``` 此事件處理程序可以重新實現來處理狀態的變化。 在這種情況下被改變的狀態可以通過檢索_event_。 更改事件包括:[QEvent.ActivationChange](qevent.html#Type-enum),[QEvent.EnabledChange](qevent.html#Type-enum),[QEvent.FontChange](qevent.html#Type-enum),[QEvent.StyleChange](qevent.html#Type-enum),[QEvent.PaletteChange](qevent.html#Type-enum),[QEvent.ParentChange](qevent.html#Type-enum),[QEvent.LayoutDirectionChange](qevent.html#Type-enum)和[QEvent.ContentsRectChange](qevent.html#Type-enum)。 ``` bool QGraphicsWidget.close (self) ``` 這種方法也是一個Qt槽與C + +的簽名`bool close()`。 調用這個函數來關閉該窗口小部件。 返回True如果部件被關閉,否則返回False 。此插槽會先發送一個[QCloseEvent](qcloseevent.html)到窗口小部件,它可以或不可以接受的事件。如果事件被忽略,沒有任何反應。如果事件被接受,它會[hide](qgraphicsitem.html#hide)()的部件。 如果部件有[Qt.WA_DeleteOnClose](qt.html#WidgetAttribute-enum)屬性設置將被刪除。 ``` QGraphicsWidget.closeEvent (self, QCloseEvent?event) ``` 此事件處理程序,對于_event_,可重新實現在子類中接收部件關閉事件。默認實現接受的事件。 **See also** [close](qgraphicswidget.html#close)()和[QCloseEvent](qcloseevent.html)。 ``` bool QGraphicsWidget.event (self, QEvent?event) ``` 從重新實現[QObject.event](qobject.html#event)( ) 。 處理_event_。[QGraphicsWidget](qgraphicswidget.html)處理以下事項: | Polish | Delivered to the widget some time after it has been shown. | | GraphicsSceneMove | Delivered to the widget after its local position has changed. | | GraphicsSceneResize | Delivered to the widget after its size has changed. | | Show | Delivered to the widget before it has been shown. | | Hide | Delivered to the widget after it has been hidden. | | PaletteChange | Delivered to the widget after its palette has changed. | | FontChange | Delivered to the widget after its font has changed. | | EnabledChange | Delivered to the widget after its enabled state has changed. | | StyleChange | Delivered to the widget after its style has changed. | | LayoutDirectionChange | Delivered to the widget after its layout direction has changed. | | ContentsRectChange | Delivered to the widget after its contents margins/ contents rect has changed. | ``` QGraphicsWidget.focusInEvent (self, QFocusEvent?event) ``` 從重新實現[QGraphicsItem.focusInEvent](qgraphicsitem.html#focusInEvent)( ) 。 ``` bool QGraphicsWidget.focusNextPrevChild (self, bool?next) ``` 發現一個新的widget ,讓鍵盤焦點,以適合Tab和Shift + Tab鍵,如果能找到一個新的widget返回True,否則返回False 。如果_next_誠然,這個函數向前搜索,如果_next_是假的,它向后搜索。 有時候,你會希望重新實現這個功能,為您的小工具,其subwidgets提供特別注重處理。例如,一個Web瀏覽器可能會重新實現它移動到其當前活動鏈接向前或向后,并調用基實現,只有當它到達頁面上的最后一個或第一個鏈接。 子控件調用focusNextPrevChild ( )對它們的父窗口部件,但只有包含的子控件的窗口決定重定向到哪里焦點。通過重新實現這個函數的對象時,你獲得控制焦點遍歷所有子控件。 **See also** [focusPolicy](qgraphicswidget.html#focusPolicy-prop)( ) 。 ``` QGraphicsWidget.focusOutEvent (self, QFocusEvent?event) ``` 從重新實現[QGraphicsItem.focusOutEvent](qgraphicsitem.html#focusOutEvent)( ) 。 ``` Qt.FocusPolicy QGraphicsWidget.focusPolicy (self) ``` [](qt.html#FocusPolicy-enum) ``` QGraphicsWidget QGraphicsWidget.focusWidget (self) ``` [ 如果這個小工具的這個小工具,一個孩子或后代目前擁有輸入焦點時,這個函數會返回一個指向窗口小部件。如果沒有后代部件有輸入焦點,則返回0 。 ](qgraphicswidget.html) [**See also**](qgraphicswidget.html) [QGraphicsItem.focusItem](qgraphicsitem.html#focusItem)()和[QWidget.focusWidget](qwidget.html#focusWidget)( ) 。 ``` QFont QGraphicsWidget.font (self) ``` [ ``` (float?left, float?top, float?right, float?bottom) QGraphicsWidget.getContentsMargins (self) ``` ](qfont.html) [從重新實現](qfont.html)[QGraphicsLayoutItem.getContentsMargins](qgraphicslayoutitem.html#getContentsMargins)( ) 。 獲取控件的內容利潤率。頁邊距都存儲在_left_,_top_,_right_和_bottom_,作為指針指向qreals 。每個參數可以是_omitted_通過傳遞0 。 **See also** [setContentsMargins](qgraphicswidget.html#setContentsMargins)( ) 。 ``` (float?left, float?top, float?right, float?bottom) QGraphicsWidget.getWindowFrameMargins (self) ``` 獲取控件的窗口框架的利潤。頁邊距都存儲在_left_,_top_,_right_和_bottom_作為指針指向qreals 。每個參數可以是_omitted_通過傳遞0 。 **See also** [setWindowFrameMargins](qgraphicswidget.html#setWindowFrameMargins)()和[windowFrameRect](qgraphicswidget.html#windowFrameRect)( ) 。 ``` QGraphicsWidget.grabKeyboardEvent (self, QEvent?event) ``` 此事件處理程序,對于_event_,可以在子類來接收通知被重新實現[QEvent.GrabKeyboard](qevent.html#Type-enum)事件。 **See also** [grabKeyboard](qgraphicsitem.html#grabKeyboard)()和[grabMouse](qgraphicsitem.html#grabMouse)( ) 。 ``` QGraphicsWidget.grabMouseEvent (self, QEvent?event) ``` 此事件處理程序,對于_event_,可以在子類來接收通知被重新實現[QEvent.GrabMouse](qevent.html#Type-enum)事件。 **See also** [grabMouse](qgraphicsitem.html#grabMouse)()和[grabKeyboard](qgraphicsitem.html#grabKeyboard)( ) 。 ``` int QGraphicsWidget.grabShortcut (self, QKeySequence?sequence, Qt.ShortcutContext?context?=?Qt.WindowShortcut) ``` 增加了一個快捷方式到Qt的快捷鍵系統,手表對于給定的鍵_sequence_在給定的_context_。如果_context_ is [Qt.ApplicationShortcut](qt.html#ShortcutContext-enum),快捷適用于應用程序作為一個整體。否則,要么是本地的這個小工具,[Qt.WidgetShortcut](qt.html#ShortcutContext-enum),或者窗口本身,[Qt.WindowShortcut](qt.html#ShortcutContext-enum)。對于小部件不屬于窗口的一部分(即頂層widget和他們的孩子) ,[Qt.WindowShortcut](qt.html#ShortcutContext-enum)快捷方式適用于現場。 如果相同的密鑰_sequence_已經抓住了由幾個部件,當鍵_sequence_發生[QEvent.Shortcut](qevent.html#Type-enum)事件被發送到所有的,它適用于非確定性的順序小部件,而是用``曖昧''標志設置為True 。 **Warning:**你不應該通常需要使用此功能,而是創建[QAction](qaction.html)s的您需要的快捷鍵順序(如果你也想等效的菜單選項和工具欄按鈕) ,或創建[QShortcut](qshortcut.html)■如果您只需要按鍵順序。兩[QAction](qaction.html)和[QShortcut](qshortcut.html)處理所有的事件過濾的你,提供當用戶觸發鍵序列觸發信號,所以更容易比這個低層次的功能使用。 此功能被引入Qt的4.5 。 **See also** [releaseShortcut](qgraphicswidget.html#releaseShortcut)( )[setShortcutEnabled](qgraphicswidget.html#setShortcutEnabled)()和[QWidget.grabShortcut](qwidget.html#grabShortcut)( ) 。 ``` QGraphicsWidget.hideEvent (self, QHideEvent?event) ``` 此事件處理程序,對于[Hide](qevent.html#Type-enum)事件被交付的部件已被隱藏之后,例如,其setVisible (假)被稱為小部件或其祖先之一,當小部件曾表明。 您可以重新實現此事件處理程序來檢測,當你的小部件被隱藏。調用[QEvent.accept](qevent.html#accept)()或[QEvent.ignore](qevent.html#ignore)( )上_event_沒有任何影響。 **See also** [showEvent](qgraphicswidget.html#showEvent)( )[QWidget.hideEvent](qwidget.html#hideEvent)()和[ItemVisibleChange](qgraphicsitem.html#GraphicsItemChange-enum)。 ``` QGraphicsWidget.hoverLeaveEvent (self, QGraphicsSceneHoverEvent?event) ``` 從重新實現[QGraphicsItem.hoverLeaveEvent](qgraphicsitem.html#hoverLeaveEvent)( ) 。 ``` QGraphicsWidget.hoverMoveEvent (self, QGraphicsSceneHoverEvent?event) ``` 從重新實現[QGraphicsItem.hoverMoveEvent](qgraphicsitem.html#hoverMoveEvent)( ) 。 ``` QGraphicsWidget.initStyleOption (self, QStyleOption?option) ``` 填充這個小工具基于其當前狀態的樣式選項對象,并存儲在輸出_option_。默認實現填充_option_具有以下屬性。 | Style Option Property | Value | | --- | --- | | state & [QStyle.State_Enabled](qstyle.html#StateFlag-enum) | Corresponds to [QGraphicsItem.isEnabled](qgraphicsitem.html#isEnabled)(). | | state & [QStyle.State_HasFocus](qstyle.html#StateFlag-enum) | Corresponds to [QGraphicsItem.hasFocus](qgraphicsitem.html#hasFocus)(). | | state & [QStyle.State_MouseOver](qstyle.html#StateFlag-enum) | Corresponds to [QGraphicsItem.isUnderMouse](qgraphicsitem.html#isUnderMouse)(). | | direction | Corresponds to [QGraphicsWidget.layoutDirection](qgraphicswidget.html#layoutDirection-prop)(). | | rect | Corresponds to [QGraphicsWidget.rect](qgraphicswidget.html#rect)().toRect(). | | palette | Corresponds to [QGraphicsWidget.palette](qgraphicswidget.html#palette-prop)(). | | fontMetrics | Corresponds to [QFontMetrics](qfontmetrics.html)([QGraphicsWidget.font](qgraphicswidget.html#font-prop)()). | 的子類[QGraphicsWidget](qgraphicswidget.html)應該調用基實現,然后測試的類型_option_使用qstyleoption_cast \u003c\u003e()或試驗[QStyleOption.Type](qstyleoption.html#StyleOptionType-enum)之前存儲部件特定的選項。 例如: ``` void MyGroupBoxWidget.initStyleOption([QStyleOption](qstyleoption.html) *option) const { [QGraphicsWidget](qgraphicswidget.html).initStyleOption(option); if ([QStyleOptionGroupBox](qstyleoptiongroupbox.html) *box = qstyleoption_cast<[QStyleOptionGroupBox](qstyleoptiongroupbox.html) *>(option)) { // Add group box specific state. box->flat = isFlat(); ... } } ``` **See also** [QStyleOption.initFrom](qstyleoption.html#initFrom)( ) 。 ``` QGraphicsWidget.insertAction (self, QAction?before, QAction?action) ``` 插入動作_action_以行動,在行動之前,這個小工具的列表_before_。其附加的行動,如果_before_是0或_before_是不是這個小工具的有效行動。 A [QGraphicsWidget](qgraphicswidget.html)應該只有每個動作之一。 此功能被引入Qt的4.5 。 **See also** [removeAction](qgraphicswidget.html#removeAction)( )[addAction](qgraphicswidget.html#addAction)( )[QMenu](qmenu.html),[actions](qgraphicswidget.html#actions)()和[QWidget.insertActions](qwidget.html#insertActions)( ) 。 ``` QGraphicsWidget.insertActions (self, QAction?before, list-of-QAction?actions) ``` 插入動作_actions_以行動,在行動之前,這個小工具的列表_before_。其附加的行動,如果_before_是0或_before_是不是這個小工具的有效行動。 A [QGraphicsWidget](qgraphicswidget.html)最多可以有各一個動作。 此功能被引入Qt的4.5 。 **See also** [removeAction](qgraphicswidget.html#removeAction)( )[QMenu](qmenu.html),[insertAction](qgraphicswidget.html#insertAction)()和[QWidget.insertActions](qwidget.html#insertActions)( ) 。 ``` bool QGraphicsWidget.isActiveWindow (self) ``` 返回True如果這個窗口部件的窗口是活動窗口,或者如果控件沒有窗口,但在活躍現場(即,一個場景,當前具有焦點) 。 活動窗口是不是包含當前具有輸入焦點的子控件的窗口,或者說本身有輸入焦點。 **See also** [QGraphicsScene.activeWindow](qgraphicsscene.html#activeWindow)( )[QGraphicsScene.setActiveWindow](qgraphicsscene.html#setActiveWindow)()和[isActive](qgraphicsitem.html#isActive)( ) 。 ``` QVariant QGraphicsWidget.itemChange (self, QGraphicsItem.GraphicsItemChange?change, QVariant?value) ``` 從重新實現[QGraphicsItem.itemChange](qgraphicsitem.html#itemChange)( ) 。 [QGraphicsWidget](qgraphicswidget.html)使用此函數的基實現追趕,并提供相關的項狀態變化的事件。因為這一點,這是很重要的,子類調用基實現。 _change_指定變化的類型,并_value_為新的值。 例如,[QGraphicsWidget](qgraphicswidget.html) uses [ItemVisibleChange](qgraphicsitem.html#GraphicsItemChange-enum)交付[Show](qevent.html#Type-enum)和[Hide](qevent.html#Type-enum)事件,[ItemPositionHasChanged](qgraphicsitem.html#GraphicsItemChange-enum)交付[Move](qevent.html#Type-enum)事件,以及[ItemParentChange](qgraphicsitem.html#GraphicsItemChange-enum)既提供[ParentChange](qevent.html#Type-enum)事件,以及用于管理的重點鏈。 [QGraphicsWidget](qgraphicswidget.html)使[ItemSendsGeometryChanges](qgraphicsitem.html#GraphicsItemFlag-enum)標志在默認情況下,以追蹤位置的變化。 **See also** [QGraphicsItem.itemChange](qgraphicsitem.html#itemChange)( ) 。 ``` QGraphicsLayout QGraphicsWidget.layout (self) ``` [](qgraphicslayout.html) ``` Qt.LayoutDirection QGraphicsWidget.layoutDirection (self) ``` [ ``` QGraphicsWidget.moveEvent (self, QGraphicsSceneMoveEvent?event) ``` ](qt.html#LayoutDirection-enum) [此事件處理程序,對于](qt.html#LayoutDirection-enum)[GraphicsSceneMove](qevent.html#Type-enum)事件,交付后的小部件移動時(例如,它的局部位置發生了變化) 。 當項目在本地移動此事件只交付。調用[setTransform](qgraphicsitem.html#setTransform)()或移動的任何項的祖先不影響產品的本地位置。 您可以重新實現此事件處理程序來檢測你的部件已經移動了。調用[QEvent.accept](qevent.html#accept)()或[QEvent.ignore](qevent.html#ignore)( )上_event_沒有任何影響。 **See also** [ItemPositionChange](qgraphicsitem.html#GraphicsItemChange-enum)和[ItemPositionHasChanged](qgraphicsitem.html#GraphicsItemChange-enum)。 ``` QGraphicsWidget.paint (self, QPainter?painter, QStyleOptionGraphicsItem?option, QWidget?widget?=?None) ``` 從重新實現[QGraphicsItem.paint](qgraphicsitem.html#paint)( ) 。 ``` QGraphicsWidget.paintWindowFrame (self, QPainter?painter, QStyleOptionGraphicsItem?option, QWidget?widget?=?None) ``` 這個虛函數被調用[QGraphicsScene](qgraphicsscene.html)繪制使用Windows的窗口框架_painter_,_option_和_widget_在局部坐標。該基地實現使用目前的風格來渲染框架和標題欄。 您可以在子類中重新實現這個功能[QGraphicsWidget](qgraphicswidget.html)提供widget的窗口框架的自定義呈現。 **See also** [QGraphicsItem.paint](qgraphicsitem.html#paint)( ) 。 ``` QPalette QGraphicsWidget.palette (self) ``` [ ``` QGraphicsWidget.polishEvent (self) ``` 該事件是在它已經被構造之后某一時刻傳送到產品的場景,但它示出或以其它方式通過現場訪問之前。您可以使用此事件處理程序做需要被完全建成的項目widget的最后一分鐘的初始化。 基實現不執行任何操作。 ](qpalette.html) ``` QRectF QGraphicsWidget.rect (self) ``` [](qrectf.html) [返回該項目的本地矩形作為](qrectf.html)[QRectF](qrectf.html)。此功能相當于[QRectF](qrectf.html)( QPointF ( ) ,[size](qgraphicswidget.html#size-prop)())。 **See also** [setGeometry](qgraphicswidget.html#geometry-prop)()和[resize](qgraphicswidget.html#size-prop)( ) 。 ``` QGraphicsWidget.releaseShortcut (self, int?id) ``` 刪除快捷方式與給定_id_從Qt的快捷鍵系統。該部件將不再接收[QEvent.Shortcut](qevent.html#Type-enum)事件的快捷方式的按鍵順序(除非它使用相同的密鑰序列的其他快捷方式) 。 **Warning:**你不應該通常需要使用此功能,因為Qt的快捷鍵系統自動刪除快捷方式時,他們的父窗口部件被銷毀。最好是使用[QAction](qaction.html) or [QShortcut](qshortcut.html)處理快捷方式,因為它們更容易比這低級別的功能來使用。還請注意,這是一個昂貴的操作。 此功能被引入Qt的4.5 。 **See also** [grabShortcut](qgraphicswidget.html#grabShortcut)( )[setShortcutEnabled](qgraphicswidget.html#setShortcutEnabled)()和[QWidget.releaseShortcut](qwidget.html#releaseShortcut)( ) 。 ``` QGraphicsWidget.removeAction (self, QAction?action) ``` 刪除動作_action_從操作這個小工具的列表。 此功能被引入Qt的4.5 。 **See also** [insertAction](qgraphicswidget.html#insertAction)( )[actions](qgraphicswidget.html#actions)( )[insertAction](qgraphicswidget.html#insertAction)()和[QWidget.removeAction](qwidget.html#removeAction)( ) 。 ``` QGraphicsWidget.resize (self, QSizeF?size) ``` ``` QGraphicsWidget.resize (self, float?w, float?h) ``` ``` QGraphicsWidget.resizeEvent (self, QGraphicsSceneResizeEvent?event) ``` 此事件處理程序,對于[GraphicsSceneResize](qevent.html#Type-enum)事件,交付后的小部件已調整大小(即其本地大小已更改) 。_event_包含舊的和新的大小。 當小部件局部調整此事件只交付;調用[setTransform](qgraphicsitem.html#setTransform)( )上的小工具或任何其祖先或視圖,不影響部件的局部尺寸。 您可以重新實現此事件處理程序來檢測你的widget已經被調整。調用[QEvent.accept](qevent.html#accept)()或[QEvent.ignore](qevent.html#ignore)( )上_event_沒有任何影響。 **See also** [geometry](qgraphicslayoutitem.html#geometry)()和[setGeometry](qgraphicswidget.html#geometry-prop)( ) 。 ``` bool QGraphicsWidget.sceneEvent (self, QEvent?event) ``` 從重新實現[QGraphicsItem.sceneEvent](qgraphicsitem.html#sceneEvent)( ) 。 [QGraphicsWidget](qgraphicswidget.html)的實施sceneEvent的( )只是簡單地傳遞_event_至[QGraphicsWidget.event](qgraphicswidget.html#event)( ) 。你可以處理你的widget中的所有事件[event](qgraphicswidget.html#event)( ),或在任何方便的功能,你不應該重寫本函數中的一個子類[QGraphicsWidget](qgraphicswidget.html)。 **See also** [QGraphicsItem.sceneEvent](qgraphicsitem.html#sceneEvent)( ) 。 ``` QGraphicsWidget.setAttribute (self, Qt.WidgetAttribute?attribute, bool?on?=?True) ``` If _on_誠然,這個功能可以讓_attribute_否則_attribute_被禁用。 請參閱類文檔[QGraphicsWidget](qgraphicswidget.html)對于其中的完整列表屬性的支持,他們是干什么用的。 **See also** [testAttribute](qgraphicswidget.html#testAttribute)()和[QWidget.setAttribute](qwidget.html#setAttribute)( ) 。 ``` QGraphicsWidget.setAutoFillBackground (self, bool?enabled) ``` ``` QGraphicsWidget.setContentsMargins (self, float?left, float?top, float?right, float?bottom) ``` 設置widget的內容邊距_left_,_top_,_right_和_bottom_。 內容頁邊距所使用的分配布局定義放置subwidgets和布局。利潤是制約subwidgets自身的幾何形狀只有部分小部件特別有用。例如,一個布局的一組框將放置subwidgets其框架內的,但下面的標題。 變更小工具的內容利潤率將始終觸發[update](qgraphicsitem.html#update)( ) ,以及任何指定的布局將被自動激活。那么該部件將收到[ContentsRectChange](qevent.html#Type-enum)事件。 **See also** [getContentsMargins](qgraphicswidget.html#getContentsMargins)()和[setGeometry](qgraphicswidget.html#geometry-prop)( ) 。 ``` QGraphicsWidget.setFocusPolicy (self, Qt.FocusPolicy?policy) ``` ``` QGraphicsWidget.setFont (self, QFont?font) ``` ``` QGraphicsWidget.setGeometry (self, QRectF?rect) ``` ``` QGraphicsWidget.setGeometry (self, float?ax, float?ay, float?aw, float?ah) ``` ``` QGraphicsWidget.setLayout (self, QGraphicsLayout?layout) ``` 該_layout_說法有它的所有權轉移給Qt的。 ``` QGraphicsWidget.setLayoutDirection (self, Qt.LayoutDirection?direction) ``` ``` QGraphicsWidget.setPalette (self, QPalette?palette) ``` ``` QGraphicsWidget.setShortcutAutoRepeat (self, int?id, bool?enabled?=?True) ``` If _enabled_誠然,汽車與給定的快捷方式重復_id_被啟用,否則它被禁用。 此功能被引入Qt的4.5 。 **See also** [grabShortcut](qgraphicswidget.html#grabShortcut)( )[releaseShortcut](qgraphicswidget.html#releaseShortcut)()和[QWidget.setShortcutAutoRepeat](qwidget.html#setShortcutAutoRepeat)( ) 。 ``` QGraphicsWidget.setShortcutEnabled (self, int?id, bool?enabled?=?True) ``` If _enabled_誠然,使用快捷給定的_id_被啟用,否則快捷方式被禁用。 **Warning:**你不應該通常需要使用此功能,因為Qt的快捷鍵系統啟用/禁用自動快捷方式小部件變為隱藏/可見和獲得或失去焦點。最好是使用[QAction](qaction.html) or [QShortcut](qshortcut.html)處理快捷方式,因為它們更容易比這低級別的功能來使用。 此功能被引入Qt的4.5 。 **See also** [grabShortcut](qgraphicswidget.html#grabShortcut)( )[releaseShortcut](qgraphicswidget.html#releaseShortcut)()和[QWidget.setShortcutEnabled](qwidget.html#setShortcutEnabled)( ) 。 ``` QGraphicsWidget.setStyle (self, QStyle?style) ``` 設置widget的風格_style_。[QGraphicsWidget](qgraphicswidget.html)不_not_取得其所有權_style_。 如果沒有指定樣式分配,或_style_為0時,窗口小部件將使用[QGraphicsScene.style](qgraphicsscene.html#style)() (如果這已被設置) 。否則,部件將使用[QApplication.style](qapplication.html#style)( ) 。 該函數設置[Qt.WA_SetStyle](qt.html#WidgetAttribute-enum)如果屬性_style_不為0 ,否則它清除該屬性。 **See also** [style](qgraphicswidget.html#style)( ) 。 ``` QGraphicsWidget.setTabOrder (QGraphicsWidget?first, QGraphicsWidget?second) ``` 移動_second_圍繞焦點窗口小部件的環部件,以便從鍵盤焦點移動_first_窗口小部件的_second_當按下Tab鍵時控件。 需要注意的是,因為的Tab鍵順序_second_窗口小部件被改變,你應該訂購鏈是這樣的: ``` setTabOrder(a, b); // a to b setTabOrder(b, c); // a to b to c setTabOrder(c, d); // a to b to c to d ``` _not_像這樣: ``` // WRONG setTabOrder(c, d); // c to d setTabOrder(a, b); // a to b AND c to d setTabOrder(b, c); // a to b to c, but not c to d ``` If _first_是0 ,這表明_second_應該是要現場增益選項卡焦點(即用戶點擊標籤,讓焦點傳遞到場景)來接收輸入焦點的第一個部件。如果_second_是0 ,這表明_first_應該是第一個部件獲得焦點,如果在現場獲得了BACKTAB焦點。 默認情況下, Tab鍵順序的定義是隱式使用窗口小部件創建的順序。 **See also** [focusPolicy](qgraphicswidget.html#focusPolicy-prop)和[Keyboard Focus](index.htm)。 ``` QGraphicsWidget.setWindowFlags (self, Qt.WindowFlags?wFlags) ``` ``` QGraphicsWidget.setWindowFrameMargins (self, float?left, float?top, float?right, float?bottom) ``` 設置控件的窗口框架邊距_left_,_top_,_right_和_bottom_。默認幀的利潤是由風格提供,它們依賴于當前窗口的標志。 如果您想自己繪制窗口裝飾,你可以設置你自己的幀的利潤來復蓋默認的頁邊距。 **See also** [unsetWindowFrameMargins](qgraphicswidget.html#unsetWindowFrameMargins)( )[getWindowFrameMargins](qgraphicswidget.html#getWindowFrameMargins)()和[windowFrameRect](qgraphicswidget.html#windowFrameRect)( ) 。 ``` QGraphicsWidget.setWindowTitle (self, QString?title) ``` ``` QPainterPath QGraphicsWidget.shape (self) ``` [](qpainterpath.html) [從重新實現](qpainterpath.html)[QGraphicsItem.shape](qgraphicsitem.html#shape)( ) 。 ``` QGraphicsWidget.showEvent (self, QShowEvent?event) ``` 此事件處理程序,對于[Show](qevent.html#Type-enum)事件,被輸送的部件已被證明之前,例如,其setVisible (真)被稱為用于其祖先當插件先前被隱藏的窗口小部件或1 。 您可以重新實現此事件處理程序來檢測你的widget顯示時。調用[QEvent.accept](qevent.html#accept)()或[QEvent.ignore](qevent.html#ignore)( )上_event_沒有任何影響。 **See also** [hideEvent](qgraphicswidget.html#hideEvent)( )[QWidget.showEvent](qwidget.html#showEvent)()和[ItemVisibleChange](qgraphicsitem.html#GraphicsItemChange-enum)。 ``` QSizeF QGraphicsWidget.size (self) ``` [](qsizef.html) ``` QSizeF QGraphicsWidget.sizeHint (self, Qt.SizeHint?which, QSizeF?constraint?=?QSizeF()) ``` [](qsizef.html) [從重新實現](qsizef.html)[QGraphicsLayoutItem.sizeHint](qgraphicslayoutitem.html#sizeHint)( ) 。 ``` QStyle QGraphicsWidget.style (self) ``` [](qstyle.html) [返回一個指向widget的風格。如果這個窗口部件沒有任何明確指定的樣式,返回場景的風格來代替。反過來,如果現場沒有任何指定的樣式,該函數返回](qstyle.html)[QApplication.style](qapplication.html#style)( ) 。 **See also** [setStyle](qgraphicswidget.html#setStyle)( ) 。 ``` bool QGraphicsWidget.testAttribute (self, Qt.WidgetAttribute?attribute) ``` 返回True如果_attribute_是啟用了這個小工具,否則返回False 。 **See also** [setAttribute](qgraphicswidget.html#setAttribute)( ) 。 ``` int QGraphicsWidget.type (self) ``` 從重新實現[QGraphicsItem.type](qgraphicsitem.html#type)( ) 。 ``` QGraphicsWidget.ungrabKeyboardEvent (self, QEvent?event) ``` 此事件處理程序,對于_event_,可以在子類來接收通知被重新實現[QEvent.UngrabKeyboard](qevent.html#Type-enum)事件。 **See also** [ungrabKeyboard](qgraphicsitem.html#ungrabKeyboard)()和[ungrabMouse](qgraphicsitem.html#ungrabMouse)( ) 。 ``` QGraphicsWidget.ungrabMouseEvent (self, QEvent?event) ``` 此事件處理程序,對于_event_,可以在子類來接收通知被重新實現[QEvent.UngrabMouse](qevent.html#Type-enum)事件。 **See also** [ungrabMouse](qgraphicsitem.html#ungrabMouse)()和[ungrabKeyboard](qgraphicsitem.html#ungrabKeyboard)( ) 。 ``` QGraphicsWidget.unsetLayoutDirection (self) ``` ``` QGraphicsWidget.unsetWindowFrameMargins (self) ``` 重置窗框利潤率為默認值,由式提供。 **See also** [setWindowFrameMargins](qgraphicswidget.html#setWindowFrameMargins)( )[getWindowFrameMargins](qgraphicswidget.html#getWindowFrameMargins)()和[windowFrameRect](qgraphicswidget.html#windowFrameRect)( ) 。 ``` QGraphicsWidget.updateGeometry (self) ``` 從重新實現[QGraphicsLayoutItem.updateGeometry](qgraphicslayoutitem.html#updateGeometry)( ) 。 如果這個小工具是由目前的布局管理,該功能會通知該物件的尺寸暗示已經有所轉變,布局可能需要相應地調整和重新定位插件的布局。 調用此函數,如果widget的[sizeHint](qgraphicswidget.html#sizeHint)( )發生了變化。 **See also** [QGraphicsLayout.invalidate](qgraphicslayout.html#invalidate)( ) 。 ``` Qt.WindowFlags QGraphicsWidget.windowFlags (self) ``` [ ``` bool QGraphicsWidget.windowFrameEvent (self, QEvent?e) ``` 此事件處理程序,對于_event_,用于接收窗框事件,如果這個小工具是一個窗口。其基本實現提供默認的窗口框架的互動,如移動,調整大小等支持 ](index.htm) [您可以在子類中重新實現這個處理器](index.htm)[QGraphicsWidget](qgraphicswidget.html)提供您自己的自定義窗框交互的支持。 返回True如果_event_已被確認和處理,否則返回False 。 **See also** [event](qgraphicswidget.html#event)( ) 。 ``` QRectF QGraphicsWidget.windowFrameGeometry (self) ``` [ 返回父坐標包括任何窗口框架的窗口部件的幾何形狀。 ](qrectf.html) [**See also**](qrectf.html) [windowFrameRect](qgraphicswidget.html#windowFrameRect)( )[getWindowFrameMargins](qgraphicswidget.html#getWindowFrameMargins)()和[setWindowFrameMargins](qgraphicswidget.html#setWindowFrameMargins)( ) 。 ``` QRectF QGraphicsWidget.windowFrameRect (self) ``` [ 返回小部件的地方矩形包括任何窗口框架。 ](qrectf.html) [**See also**](qrectf.html) [windowFrameGeometry](qgraphicswidget.html#windowFrameGeometry)( )[getWindowFrameMargins](qgraphicswidget.html#getWindowFrameMargins)()和[setWindowFrameMargins](qgraphicswidget.html#setWindowFrameMargins)( ) 。 ``` Qt.WindowFrameSection QGraphicsWidget.windowFrameSectionAt (self, QPointF?pos) ``` [](qt.html#WindowFrameSection-enum) [返回在位置窗框部分_pos_或](qt.html#WindowFrameSection-enum)[Qt.NoSection](qt.html#WindowFrameSection-enum)如果有在這個位置上沒有窗框部分。 此功能用于在[QGraphicsWidget](qgraphicswidget.html)的基實現窗框互動。 如果你想自定義窗口如何可以交互移動或調整大小您可以重新實現此功能。例如,如果您只想讓窗口的右下角來調整大小,您可以重新實現這個函數返回[Qt.NoSection](qt.html#WindowFrameSection-enum)對于除部分[Qt.BottomRightSection](qt.html#WindowFrameSection-enum)。 此功能被引入Qt的4.4 。 **See also** [windowFrameEvent](qgraphicswidget.html#windowFrameEvent)( )[paintWindowFrame](qgraphicswidget.html#paintWindowFrame)()和[windowFrameGeometry](qgraphicswidget.html#windowFrameGeometry)( ) 。 ``` QString QGraphicsWidget.windowTitle (self) ``` ``` Qt.WindowType QGraphicsWidget.windowType (self) ``` [ 返回小部件窗口類型。 ](qt.html#WindowType-enum) [**See also**](qt.html#WindowType-enum) [windowFlags](qgraphicswidget.html#windowFlags-prop)( )[isWindow](qgraphicsitem.html#isWindow)()和[isPanel](qgraphicsitem.html#isPanel)( ) 。 * * * ## Qt Signal Documentation ``` void geometryChanged () ``` 這是該信號的默認超載。 這個信號被發射時的幾何形狀的改變[setGeometry](qgraphicswidget.html#geometry-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>

                              哎呀哎呀视频在线观看