QGraphicsWidget Class Reference

[QtGui module]

该QGraphicsWidget类是在所有部件项目的基类QGraphicsSceneMore…

继承QGraphicsObjectQGraphicsLayoutItem

通过继承QGraphicsProxyWidgetQGraphicsWebView

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

QGraphicsWidget是一个扩展的基地项目,超过提供额外的功能QGraphicsItem。它类似于QWidget在很多方面:

不像QGraphicsItem, QGraphicsWidget不是一个抽象类,你可以创建一个QGraphicsWidget的实例,而无需继承它。这种方法对小部件,只有服务于构建子控件到布局的目的是有用的。

QGraphicsWidget如果您需要先进的输入焦点的处理,例如,标籤对焦和激活,或布局被用来作为自己的自定义项目的基础项目。

由于QGraphicsWidget酷似QWidget并具有类似的API ,它更容易端口插件从QWidget到QGraphicsWidget ,而不是QGraphicsItem

Note: QWidget基于窗口小部件可以被直接嵌入到一个QGraphicsScene using QGraphicsProxyWidget

QGraphicsWidget之间明显的差异QWidget分别是:

QGraphicsWidget QWidget
Coordinates and geometry are defined with qreals (doubles or floats, depending on the platform). QWidget uses integer geometry (QPoint, QRect).
The widget is already visible by default; you do not have to call show() to display the widget. QWidget is hidden by default until you call 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. Standard drag and drop framework.
Widget items do not support modality. Full modality support.

QGraphicsWidget支持Qt的窗口部件的属性的一个子集, (Qt.WidgetAttribute)所示,在下表中。本表中未列出的任何属性是不支持的,或以其他方式使用。

Widget Attribute Usage
Qt.WA_SetLayoutDirection Set by setLayoutDirection(), cleared by unsetLayoutDirection(). You can test this attribute to check if the widget has been explicitly assigned a layoutDirection. If the attribute is not set, the layoutDirection() is inherited.
Qt.WA_RightToLeft Toggled by setLayoutDirection(). Inherited from the parent/scene. If set, the widget’s layout will order horizontally arranged widgets from right to left.
Qt.WA_SetStyle Set and cleared by 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 Set by setGeometry() and resize().
Qt.WA_SetPalette Set by setPalette().
Qt.WA_SetFont Set by setFont().
Qt.WA_WindowPropagation Enables propagation to window widgets.

虽然QGraphicsWidget从两个继承QObjectQGraphicsItem,你应该使用所提供的功能QGraphicsItemnot QObject,管理父和子项之间的关系。这些功能控制项目的堆叠顺序以及它们的所有权。

Note:QObject.parent( )应该总是返回0 QGraphicsWidgets ,但这项政策没有严格的定义。


Method Documentation

  1. QGraphicsWidget.__init__ (self, QGraphicsItem parent = None, Qt.WindowFlags flags = 0)

parent的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。

构造一个QGraphicsWidget实例。可选的parent参数被传递给QGraphicsItem的构造。可选的wFlags参数指定了小部件的窗口标志(例如,小部件是否应该是一个窗口,一个工具,一个弹出式等) 。

  1. list-of-QAction QGraphicsWidget.actions (self)

返回这个窗口部件的动作(可能为空)列表。

此功能被引入Qt的4.5 。

See also insertAction( )removeAction( )QWidget.actions( )QAction.associatedWidgets()和QAction.associatedGraphicsWidgets( ) 。

  1. QGraphicsWidget.addAction (self, QAction action)

追加行动action以行动这个小工具的列表。

所有QGraphicsWidgets具有列表QAction秒,但是它们可以被以图形方式在许多不同的方式来表示。在默认情况下使用的QAction列表(所返回actions())是创建一个上下文QMenu

A QGraphicsWidget应该只有每个动作中的一个,并将其添加已经有一个操作不会导致相同的动作是在插件的两倍。

此功能被引入Qt的4.5 。

See also removeAction( )insertAction( )actions()和QWidget.addAction( ) 。

  1. QGraphicsWidget.addActions (self, list-of-QAction actions)

追加行动actions以行动这个小工具的列表。

此功能被引入Qt的4.5 。

See also removeAction( )QMenuaddAction()和QWidget.addActions( ) 。

  1. QGraphicsWidget.adjustSize (self)

调整小部件的大小达到有效的首选大小的提示。

这个函数被调用时隐式的项目显示的第一次。

See also effectiveSizeHint()和Qt.MinimumSize

  1. bool QGraphicsWidget.autoFillBackground (self)
  1. QRectF QGraphicsWidget.boundingRect (self)

从重新实现QGraphicsItem.boundingRect( ) 。

  1. QGraphicsWidget.changeEvent (self, QEvent event)

此事件处理程序可以重新实现来处理状态的变化。

在这种情况下被改变的状态可以通过检索event

更改事件包括:QEvent.ActivationChangeQEvent.EnabledChangeQEvent.FontChangeQEvent.StyleChangeQEvent.PaletteChangeQEvent.ParentChangeQEvent.LayoutDirectionChangeQEvent.ContentsRectChange

  1. bool QGraphicsWidget.close (self)

这种方法也是一个Qt槽与C + +的签名bool close()

调用这个函数来关闭该窗口小部件。

返回True如果部件被关闭,否则返回False 。此插槽会先发送一个QCloseEvent到窗口小部件,它可以或不可以接受的事件。如果事件被忽略,没有任何反应。如果事件被接受,它会hide()的部件。

如果部件有Qt.WA_DeleteOnClose属性设置将被删除。

  1. QGraphicsWidget.closeEvent (self, QCloseEvent event)

此事件处理程序,对于event,可重新实现在子类中接收部件关闭事件。默认实现接受的事件。

See also close()和QCloseEvent

  1. bool QGraphicsWidget.event (self, QEvent event)

从重新实现QObject.event( ) 。

处理eventQGraphicsWidget处理以下事项:

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

  1. QGraphicsWidget.focusInEvent (self, QFocusEvent event)

从重新实现QGraphicsItem.focusInEvent( ) 。

  1. bool QGraphicsWidget.focusNextPrevChild (self, bool next)

发现一个新的widget ,让键盘焦点,以适合Tab和Shift + Tab键,如果能找到一个新的widget返回True,否则返回False 。如果next诚然,这个函数向前搜索,如果next是假的,它向后搜索。

有时候,你会希望重新实现这个功能,为您的小工具,其subwidgets提供特别注重处理。例如,一个Web浏览器可能会重新实现它移动到其当前活动链接向前或向后,并调用基实现,只有当它到达页面上的最后一个或第一个链接。

子控件调用focusNextPrevChild ( )对它们的父窗口部件,但只有包含的子控件的窗口决定重定向到哪里焦点。通过重新实现这个函数的对象时,你获得控制焦点遍历所有子控件。

See also focusPolicy( ) 。

  1. QGraphicsWidget.focusOutEvent (self, QFocusEvent event)

从重新实现QGraphicsItem.focusOutEvent( ) 。

  1. Qt.FocusPolicy QGraphicsWidget.focusPolicy (self)

  1. QGraphicsWidget QGraphicsWidget.focusWidget (self)

[

如果这个小工具的这个小工具,一个孩子或后代目前拥有输入焦点时,这个函数会返回一个指向窗口小部件。如果没有后代部件有输入焦点,则返回0 。

]($docs-qgraphicswidget.html)

See also QGraphicsItem.focusItem()和QWidget.focusWidget( ) 。

  1. QFont QGraphicsWidget.font (self)

[

  1. (float left, float top, float right, float bottom) QGraphicsWidget.getContentsMargins (self)

]($docs-qfont.html)

从重新实现QGraphicsLayoutItem.getContentsMargins( ) 。

获取控件的内容利润率。页边距都存储在lefttoprightbottom,作为指针指向qreals 。每个参数可以是omitted通过传递0 。

See also setContentsMargins( ) 。

  1. (float left, float top, float right, float bottom) QGraphicsWidget.getWindowFrameMargins (self)

获取控件的窗口框架的利润。页边距都存储在lefttoprightbottom作为指针指向qreals 。每个参数可以是omitted通过传递0 。

See also setWindowFrameMargins()和windowFrameRect( ) 。

  1. QGraphicsWidget.grabKeyboardEvent (self, QEvent event)

此事件处理程序,对于event,可以在子类来接收通知被重新实现QEvent.GrabKeyboard事件。

See also grabKeyboard()和grabMouse( ) 。

  1. QGraphicsWidget.grabMouseEvent (self, QEvent event)

此事件处理程序,对于event,可以在子类来接收通知被重新实现QEvent.GrabMouse事件。

See also grabMouse()和grabKeyboard( ) 。

  1. int QGraphicsWidget.grabShortcut (self, QKeySequence sequence, Qt.ShortcutContext context = Qt.WindowShortcut)

增加了一个快捷方式到Qt的快捷键系统,手表对于给定的键sequence在给定的context。如果context is Qt.ApplicationShortcut,快捷适用于应用程序作为一个整体。否则,要么是本地的这个小工具,Qt.WidgetShortcut,或者窗口本身,Qt.WindowShortcut。对于小部件不属于窗口的一部分(即顶层widget和他们的孩子) ,Qt.WindowShortcut快捷方式适用于现场。

如果相同的密钥sequence已经抓住了由几个部件,当键sequence发生QEvent.Shortcut事件被发送到所有的,它适用于非确定性的顺序小部件,而是用``暧昧’’标志设置为True 。

Warning:你不应该通常需要使用此功能,而是创建QActions的您需要的快捷键顺序(如果你也想等效的菜单选项和工具栏按钮) ,或创建QShortcut■如果您只需要按键顺序。两QActionQShortcut处理所有的事件过滤的你,提供当用户触发键序列触发信号,所以更容易比这个低层次的功能使用。

此功能被引入Qt的4.5 。

See also releaseShortcut( )setShortcutEnabled()和QWidget.grabShortcut( ) 。

  1. QGraphicsWidget.hideEvent (self, QHideEvent event)

此事件处理程序,对于Hide事件被交付的部件已被隐藏之后,例如,其setVisible (假)被称为小部件或其祖先之一,当小部件曾表明。

您可以重新实现此事件处理程序来检测,当你的小部件被隐藏。调用QEvent.accept()或QEvent.ignore( )上event没有任何影响。

See also showEvent( )QWidget.hideEvent()和ItemVisibleChange

  1. QGraphicsWidget.hoverLeaveEvent (self, QGraphicsSceneHoverEvent event)

从重新实现QGraphicsItem.hoverLeaveEvent( ) 。

  1. QGraphicsWidget.hoverMoveEvent (self, QGraphicsSceneHoverEvent event)

从重新实现QGraphicsItem.hoverMoveEvent( ) 。

  1. QGraphicsWidget.initStyleOption (self, QStyleOption option)

填充这个小工具基于其当前状态的样式选项对象,并存储在输出option。默认实现填充option具有以下属性。

Style Option Property Value
state & QStyle.State_Enabled Corresponds to QGraphicsItem.isEnabled().
state & QStyle.State_HasFocus Corresponds to QGraphicsItem.hasFocus().
state & QStyle.State_MouseOver Corresponds to QGraphicsItem.isUnderMouse().
direction Corresponds to QGraphicsWidget.layoutDirection().
rect Corresponds to QGraphicsWidget.rect().toRect().
palette Corresponds to QGraphicsWidget.palette().
fontMetrics Corresponds to QFontMetrics(QGraphicsWidget.font()).

的子类QGraphicsWidget应该调用基实现,然后测试的类型option使用qstyleoption_cast \u003c\u003e()或试验QStyleOption.Type之前存储部件特定的选项。

例如:

  1. void MyGroupBoxWidget.initStyleOption([QStyleOption](qstyleoption.html) *option) const
  2. {
  3. [QGraphicsWidget]($docs-qgraphicswidget.html).initStyleOption(option);
  4. if ([QStyleOptionGroupBox](qstyleoptiongroupbox.html) *box = qstyleoption_cast<[QStyleOptionGroupBox](qstyleoptiongroupbox.html) *>(option)) {
  5. // Add group box specific state.
  6. box->flat = isFlat();
  7. ...
  8. }
  9. }

See also QStyleOption.initFrom( ) 。

  1. QGraphicsWidget.insertAction (self, QAction before, QAction action)

插入动作action以行动,在行动之前,这个小工具的列表before。其附加的行动,如果before是0或before是不是这个小工具的有效行动。

A QGraphicsWidget应该只有每个动作之一。

此功能被引入Qt的4.5 。

See also removeAction( )addAction( )QMenuactions()和QWidget.insertActions( ) 。

  1. QGraphicsWidget.insertActions (self, QAction before, list-of-QAction actions)

插入动作actions以行动,在行动之前,这个小工具的列表before。其附加的行动,如果before是0或before是不是这个小工具的有效行动。

A QGraphicsWidget最多可以有各一个动作。

此功能被引入Qt的4.5 。

See also removeAction( )QMenuinsertAction()和QWidget.insertActions( ) 。

  1. bool QGraphicsWidget.isActiveWindow (self)

返回True如果这个窗口部件的窗口是活动窗口,或者如果控件没有窗口,但在活跃现场(即,一个场景,当前具有焦点) 。

活动窗口是不是包含当前具有输入焦点的子控件的窗口,或者说本身有输入焦点。

See also QGraphicsScene.activeWindow( )QGraphicsScene.setActiveWindow()和isActive( ) 。

  1. QVariant QGraphicsWidget.itemChange (self, QGraphicsItem.GraphicsItemChange change, QVariant value)

从重新实现QGraphicsItem.itemChange( ) 。

QGraphicsWidget使用此函数的基实现追赶,并提供相关的项状态变化的事件。因为这一点,这是很重要的,子类调用基实现。

change指定变化的类型,并value为新的值。

例如,QGraphicsWidget uses ItemVisibleChange交付ShowHide事件,ItemPositionHasChanged交付Move事件,以及ItemParentChange既提供ParentChange事件,以及用于管理的重点链。

QGraphicsWidget使ItemSendsGeometryChanges标志在默认情况下,以追踪位置的变化。

See also QGraphicsItem.itemChange( ) 。

  1. QGraphicsLayout QGraphicsWidget.layout (self)

  1. Qt.LayoutDirection QGraphicsWidget.layoutDirection (self)

[

  1. QGraphicsWidget.moveEvent (self, QGraphicsSceneMoveEvent event)

]($docs-qt.html#LayoutDirection-enum)

此事件处理程序,对于GraphicsSceneMove事件,交付后的小部件移动时(例如,它的局部位置发生了变化) 。

当项目在本地移动此事件只交付。调用setTransform()或移动的任何项的祖先不影响产品的本地位置。

您可以重新实现此事件处理程序来检测你的部件已经移动了。调用QEvent.accept()或QEvent.ignore( )上event没有任何影响。

See also ItemPositionChangeItemPositionHasChanged

  1. QGraphicsWidget.paint (self, QPainter painter, QStyleOptionGraphicsItem option, QWidget widget = None)

从重新实现QGraphicsItem.paint( ) 。

  1. QGraphicsWidget.paintWindowFrame (self, QPainter painter, QStyleOptionGraphicsItem option, QWidget widget = None)

这个虚函数被调用QGraphicsScene绘制使用Windows的窗口框架painteroptionwidget在局部坐标。该基地实现使用目前的风格来渲染框架和标题栏。

您可以在子类中重新实现这个功能QGraphicsWidget提供widget的窗口框架的自定义呈现。

See also QGraphicsItem.paint( ) 。

  1. QPalette QGraphicsWidget.palette (self)

[

  1. QGraphicsWidget.polishEvent (self)

该事件是在它已经被构造之后某一时刻传送到产品的场景,但它示出或以其它方式通过现场访问之前。您可以使用此事件处理程序做需要被完全建成的项目widget的最后一分钟的初始化。

基实现不执行任何操作。

](qpalette.html)

  1. QRectF QGraphicsWidget.rect (self)

返回该项目的本地矩形作为QRectF。此功能相当于QRectF( QPointF ( ) ,size())。

See also setGeometry()和resize( ) 。

  1. QGraphicsWidget.releaseShortcut (self, int id)

删除快捷方式与给定id从Qt的快捷键系统。该部件将不再接收QEvent.Shortcut事件的快捷方式的按键顺序(除非它使用相同的密钥序列的其他快捷方式) 。

Warning:你不应该通常需要使用此功能,因为Qt的快捷键系统自动删除快捷方式时,他们的父窗口部件被销毁。最好是使用QAction or QShortcut处理快捷方式,因为它们更容易比这低级别的功能来使用。还请注意,这是一个昂贵的操作。

此功能被引入Qt的4.5 。

See also grabShortcut( )setShortcutEnabled()和QWidget.releaseShortcut( ) 。

  1. QGraphicsWidget.removeAction (self, QAction action)

删除动作action从操作这个小工具的列表。

此功能被引入Qt的4.5 。

See also insertAction( )actions( )insertAction()和QWidget.removeAction( ) 。

  1. QGraphicsWidget.resize (self, QSizeF size)
  1. QGraphicsWidget.resize (self, float w, float h)
  1. QGraphicsWidget.resizeEvent (self, QGraphicsSceneResizeEvent event)

此事件处理程序,对于GraphicsSceneResize事件,交付后的小部件已调整大小(即其本地大小已更改) 。event包含旧的和新的大小。

当小部件局部调整此事件只交付;调用setTransform( )上的小工具或任何其祖先或视图,不影响部件的局部尺寸。

您可以重新实现此事件处理程序来检测你的widget已经被调整。调用QEvent.accept()或QEvent.ignore( )上event没有任何影响。

See also geometry()和setGeometry( ) 。

  1. bool QGraphicsWidget.sceneEvent (self, QEvent event)

从重新实现QGraphicsItem.sceneEvent( ) 。

QGraphicsWidget的实施sceneEvent的( )只是简单地传递eventQGraphicsWidget.event( ) 。你可以处理你的widget中的所有事件event( ),或在任何方便的功能,你不应该重写本函数中的一个子类QGraphicsWidget

See also QGraphicsItem.sceneEvent( ) 。

  1. QGraphicsWidget.setAttribute (self, Qt.WidgetAttribute attribute, bool on = True)

If on诚然,这个功能可以让attribute否则attribute被禁用。

请参阅类文档QGraphicsWidget对于其中的完整列表属性的支持,他们是干什么用的。

See also testAttribute()和QWidget.setAttribute( ) 。

  1. QGraphicsWidget.setAutoFillBackground (self, bool enabled)
  1. QGraphicsWidget.setContentsMargins (self, float left, float top, float right, float bottom)

设置widget的内容边距lefttoprightbottom

内容页边距所使用的分配布局定义放置subwidgets和布局。利润是制约subwidgets自身的几何形状只有部分小部件特别有用。例如,一个布局的一组框将放置subwidgets其框架内的,但下面的标题。

变更小工具的内容利润率将始终触发update( ) ,以及任何指定的布局将被自动激活。那么该部件将收到ContentsRectChange事件。

See also getContentsMargins()和setGeometry( ) 。

  1. QGraphicsWidget.setFocusPolicy (self, Qt.FocusPolicy policy)
  1. QGraphicsWidget.setFont (self, QFont font)
  1. QGraphicsWidget.setGeometry (self, QRectF rect)
  1. QGraphicsWidget.setGeometry (self, float ax, float ay, float aw, float ah)
  1. QGraphicsWidget.setLayout (self, QGraphicsLayout layout)

layout说法有它的所有权转移给Qt的。

  1. QGraphicsWidget.setLayoutDirection (self, Qt.LayoutDirection direction)
  1. QGraphicsWidget.setPalette (self, QPalette palette)
  1. QGraphicsWidget.setShortcutAutoRepeat (self, int id, bool enabled = True)

If enabled诚然,汽车与给定的快捷方式重复id被启用,否则它被禁用。

此功能被引入Qt的4.5 。

See also grabShortcut( )releaseShortcut()和QWidget.setShortcutAutoRepeat( ) 。

  1. QGraphicsWidget.setShortcutEnabled (self, int id, bool enabled = True)

If enabled诚然,使用快捷给定的id被启用,否则快捷方式被禁用。

Warning:你不应该通常需要使用此功能,因为Qt的快捷键系统启用/禁用自动快捷方式小部件变为隐藏/可见和获得或失去焦点。最好是使用QAction or QShortcut处理快捷方式,因为它们更容易比这低级别的功能来使用。

此功能被引入Qt的4.5 。

See also grabShortcut( )releaseShortcut()和QWidget.setShortcutEnabled( ) 。

  1. QGraphicsWidget.setStyle (self, QStyle style)

设置widget的风格styleQGraphicsWidgetnot取得其所有权style

如果没有指定样式分配,或style为0时,窗口小部件将使用QGraphicsScene.style() (如果这已被设置) 。否则,部件将使用QApplication.style( ) 。

该函数设置Qt.WA_SetStyle如果属性style不为0 ,否则它清除该属性。

See also style( ) 。

  1. QGraphicsWidget.setTabOrder (QGraphicsWidget first, QGraphicsWidget second)

移动second围绕焦点窗口小部件的环部件,以便从键盘焦点移动first窗口小部件的second当按下Tab键时控件。

需要注意的是,因为的Tab键顺序second窗口小部件被改变,你应该订购链是这样的:

  1. setTabOrder(a, b); // a to b
  2. setTabOrder(b, c); // a to b to c
  3. setTabOrder(c, d); // a to b to c to d

not像这样:

  1. // WRONG
  2. setTabOrder(c, d); // c to d
  3. setTabOrder(a, b); // a to b AND c to d
  4. setTabOrder(b, c); // a to b to c, but not c to d

If first是0 ,这表明second应该是要现场增益选项卡焦点(即用户点击标籤,让焦点传递到场景)来接收输入焦点的第一个部件。如果second是0 ,这表明first应该是第一个部件获得焦点,如果在现场获得了BACKTAB焦点。

默认情况下, Tab键顺序的定义是隐式使用窗口小部件创建的顺序。

See also focusPolicyKeyboard Focus

  1. QGraphicsWidget.setWindowFlags (self, Qt.WindowFlags wFlags)
  1. QGraphicsWidget.setWindowFrameMargins (self, float left, float top, float right, float bottom)

设置控件的窗口框架边距lefttoprightbottom。默认帧的利润是由风格提供,它们依赖于当前窗口的标志。

如果您想自己绘制窗口装饰,你可以设置你自己的帧的利润来复盖默认的页边距。

See also unsetWindowFrameMargins( )getWindowFrameMargins()和windowFrameRect( ) 。

  1. QGraphicsWidget.setWindowTitle (self, QString title)
  1. QPainterPath QGraphicsWidget.shape (self)

从重新实现QGraphicsItem.shape( ) 。

  1. QGraphicsWidget.showEvent (self, QShowEvent event)

此事件处理程序,对于Show事件,被输送的部件已被证明之前,例如,其setVisible (真)被称为用于其祖先当插件先前被隐藏的窗口小部件或1 。

您可以重新实现此事件处理程序来检测你的widget显示时。调用QEvent.accept()或QEvent.ignore( )上event没有任何影响。

See also hideEvent( )QWidget.showEvent()和ItemVisibleChange

  1. QSizeF QGraphicsWidget.size (self)

  1. QSizeF QGraphicsWidget.sizeHint (self, Qt.SizeHint which, QSizeF constraint = QSizeF())

从重新实现QGraphicsLayoutItem.sizeHint( ) 。

  1. QStyle QGraphicsWidget.style (self)

返回一个指向widget的风格。如果这个窗口部件没有任何明确指定的样式,返回场景的风格来代替。反过来,如果现场没有任何指定的样式,该函数返回QApplication.style( ) 。

See also setStyle( ) 。

  1. bool QGraphicsWidget.testAttribute (self, Qt.WidgetAttribute attribute)

返回True如果attribute是启用了这个小工具,否则返回False 。

See also setAttribute( ) 。

  1. int QGraphicsWidget.type (self)

从重新实现QGraphicsItem.type( ) 。

  1. QGraphicsWidget.ungrabKeyboardEvent (self, QEvent event)

此事件处理程序,对于event,可以在子类来接收通知被重新实现QEvent.UngrabKeyboard事件。

See also ungrabKeyboard()和ungrabMouse( ) 。

  1. QGraphicsWidget.ungrabMouseEvent (self, QEvent event)

此事件处理程序,对于event,可以在子类来接收通知被重新实现QEvent.UngrabMouse事件。

See also ungrabMouse()和ungrabKeyboard( ) 。

  1. QGraphicsWidget.unsetLayoutDirection (self)
  1. QGraphicsWidget.unsetWindowFrameMargins (self)

重置窗框利润率为默认值,由式提供。

See also setWindowFrameMargins( )getWindowFrameMargins()和windowFrameRect( ) 。

  1. QGraphicsWidget.updateGeometry (self)

从重新实现QGraphicsLayoutItem.updateGeometry( ) 。

如果这个小工具是由目前的布局管理,该功能会通知该物件的尺寸暗示已经有所转变,布局可能需要相应地调整和重新定位插件的布局。

调用此函数,如果widget的sizeHint( )发生了变化。

See also QGraphicsLayout.invalidate( ) 。

  1. Qt.WindowFlags QGraphicsWidget.windowFlags (self)

[

  1. bool QGraphicsWidget.windowFrameEvent (self, QEvent e)

此事件处理程序,对于event,用于接收窗框事件,如果这个小工具是一个窗口。其基本实现提供默认的窗口框架的互动,如移动,调整大小等支持

]($docs-index.htm)

您可以在子类中重新实现这个处理器QGraphicsWidget提供您自己的自定义窗框交互的支持。

返回True如果event已被确认和处理,否则返回False 。

See also event( ) 。

  1. QRectF QGraphicsWidget.windowFrameGeometry (self)

[

返回父坐标包括任何窗口框架的窗口部件的几何形状。

]($docs-qrectf.html)

See also windowFrameRect( )getWindowFrameMargins()和setWindowFrameMargins( ) 。

  1. QRectF QGraphicsWidget.windowFrameRect (self)

[

返回小部件的地方矩形包括任何窗口框架。

]($docs-qrectf.html)

See also windowFrameGeometry( )getWindowFrameMargins()和setWindowFrameMargins( ) 。

  1. Qt.WindowFrameSection QGraphicsWidget.windowFrameSectionAt (self, QPointF pos)

返回在位置窗框部分posQt.NoSection如果有在这个位置上没有窗框部分。

此功能用于在QGraphicsWidget的基实现窗框互动。

如果你想自定义窗口如何可以交互移动或调整大小您可以重新实现此功能。例如,如果您只想让窗口的右下角来调整大小,您可以重新实现这个函数返回Qt.NoSection对于除部分Qt.BottomRightSection

此功能被引入Qt的4.4 。

See also windowFrameEvent( )paintWindowFrame()和windowFrameGeometry( ) 。

  1. QString QGraphicsWidget.windowTitle (self)
  1. Qt.WindowType QGraphicsWidget.windowType (self)

[

返回小部件窗口类型。

]($docs-qt.html#WindowType-enum)

See also windowFlags( )isWindow()和isPanel( ) 。


Qt Signal Documentation

  1. void geometryChanged ()

这是该信号的默认超载。

这个信号被发射时的几何形状的改变setGeometry( ) 。