QGraphicsWidget class is the base class for all widget items in a
QGraphicsScene. 更多 …
继承者: QtCharts.QChart , QtCharts.QLegend , QtCharts.QPolarChart , QGraphicsProxyWidget
def
actions
()
def
addAction
(action)
def
addActions
(actions)
def
adjustSize
()
def
autoFillBackground
()
def
focusPolicy
()
def
focusWidget
()
def
font
()
def
getWindowFrameMargins
()
def
grabShortcut
(sequence[, context=Qt.WindowShortcut])
def
insertAction
(before, action)
def
insertActions
(before, actions)
def
isActiveWindow
()
def
layout
()
def
layoutDirection
()
def
palette
()
def
rect
()
def
releaseShortcut
(id)
def
removeAction
(action)
def
resize
(size)
def
resize
(w, h)
def
setAttribute
(attribute[, on=true])
def
setAutoFillBackground
(enabled)
def
setContentsMargins
(left, top, right, bottom)
def
setContentsMargins
(margins)
def
setFocusPolicy
(policy)
def
setFont
(font)
def
setGeometry
(x, y, w, h)
def
setLayout
(layout)
def
setLayoutDirection
(direction)
def
setPalette
(palette)
def
setShortcutAutoRepeat
(id[, enabled=true])
def
setShortcutEnabled
(id[, enabled=true])
def
setStyle
(style)
def
setWindowFlags
(wFlags)
def
setWindowFrameMargins
(left, top, right, bottom)
def
setWindowFrameMargins
(margins)
def
setWindowTitle
(title)
def
size
()
def
style
()
def
testAttribute
(attribute)
def
unsetLayoutDirection
()
def
unsetWindowFrameMargins
()
def
windowFlags
()
def
windowFrameGeometry
()
def
windowFrameRect
()
def
windowTitle
()
def
windowType
()
def
changeEvent
(event)
def
closeEvent
(event)
def
focusNextPrevChild
(next)
def
grabKeyboardEvent
(event)
def
grabMouseEvent
(event)
def
hideEvent
(event)
def
initStyleOption
(option)
def
moveEvent
(event)
def
paintWindowFrame
(painter, option[, widget=None])
def
polishEvent
()
def
propertyChange
(propertyName, value)
def
resizeEvent
(event)
def
showEvent
(event)
def
ungrabKeyboardEvent
(event)
def
ungrabMouseEvent
(event)
def
windowFrameEvent
(e)
def
windowFrameSectionAt
(pos)
def
geometryChanged
()
def
layoutChanged
()
def
setTabOrder
(first, second)
QGraphicsWidget is an extended base item that provides extra functionality over
QGraphicsItem. It is similar toQWidgetin many ways:
Has a defined
geometry().支持布局采用
setLayout()andlayout().支持快捷键和动作采用
grabShortcut()andinsertAction()不像
QGraphicsItem, QGraphicsWidget is not an abstract class; you can create instances of a QGraphicsWidget without having to subclass it. This approach is useful for widgets that only serve the purpose of organizing child widgets into a layout.QGraphicsWidget can be used as a base item for your own custom item if you require advanced input focus handling, e.g., tab focus and activation, or layouts.
Since QGraphicsWidget resembles
QWidgetand has similar API, it is easier to port a widget fromQWidgetto QGraphicsWidget , instead ofQGraphicsItem.注意
QWidget-based widgets can be directly embedded into aQGraphicsScene使用QGraphicsProxyWidget.Noticeable differences between QGraphicsWidget and
QWidget是:
Coordinates and geometry are defined with qreals (doubles or floats, depending on the platform).
The widget is already visible by default; you do not have to call
show()to display the widget.
QWidgetis hidden by default until you callshow().A subset of widget attributes are supported.
All widget attributes are supported.
A top-level item’s style defaults to
styleA top-level widget’s style defaults to
styleGraphics 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 supports a subset of Qt’s widget attributes, (
WidgetAttribute), as shown in the table below. Any attributes not listed in this table are unsupported, or otherwise unused.
Widget Attribute
用法
WA_SetLayoutDirectionSet by
setLayoutDirection(), cleared byunsetLayoutDirection(). You can test this attribute to check if the widget has been explicitly assigned alayoutDirection. If the attribute is not set, thelayoutDirection()is inherited.
WA_RightToLeftToggled by
setLayoutDirection(). Inherited from the parent/scene. If set, the widget’s layout will order horizontally arranged widgets from right to left.
WA_SetStyleSet 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.
WA_ResizedSet by
setGeometry()andresize().
WA_SetPaletteSet by
setPalette().
WA_SetFontSet by
setFont().
WA_WindowPropagationEnables propagation to window widgets.
尽管 QGraphicsWidget inherits from both
QObjectandQGraphicsItem, you should use the functions provided byQGraphicsItem, notQObject, to manage the relationships between parent and child items. These functions control the stacking order of items as well as their ownership.注意
parent()should always returnNonefor QGraphicsWidgets, but this policy is not strictly defined.
QGraphicsWidget
(
[
parent=None
[
,
wFlags=Qt.WindowFlags()
]
]
)
¶
- param parent
- param wFlags
WindowFlags
构造
QGraphicsWidget
instance. The optional
parent
自变量会被传递给
QGraphicsItem
‘s constructor. The optional
wFlags
argument specifies the widget’s window flags (e.g., whether the widget should be a window, a tool, a popup, etc).
PySide2.QtWidgets.QGraphicsWidget.
actions
(
)
¶
返回此 Widget 的动作列表 (可能为空)。
另请参阅
insertAction()
removeAction()
actions()
associatedWidgets()
associatedGraphicsWidgets()
PySide2.QtWidgets.QGraphicsWidget.
addAction
(
action
)
¶
action
–
QAction
追加动作
action
到此 Widget 的动作列表。
All QGraphicsWidgets have a list of
QAction
,无论如何,可以按多种不同方式图形表示它们。默认使用
QAction
列表 (返回通过
actions()
) is to create a context
QMenu
.
A QGraphicsWidget 只应每动作有一个,且已添加动作不会导致同一动作在 Widget 中出现两次。
PySide2.QtWidgets.QGraphicsWidget.
addActions
(
actions
)
¶
actions –
追加动作
actions
到此 Widget 的动作列表。
PySide2.QtWidgets.QGraphicsWidget.
adjustSize
(
)
¶
Adjusts the size of the widget to its effective preferred size hint.
This function is called implicitly when the item is shown for the first time.
另请参阅
effectiveSizeHint()
MinimumSize
PySide2.QtWidgets.QGraphicsWidget.
autoFillBackground
(
)
¶
bool
PySide2.QtWidgets.QGraphicsWidget.
changeEvent
(
event
)
¶
event
–
QEvent
此事件处理程序可以被重实现以处理状态改变。
The state being changed in this event can be retrieved through
event
.
改变事件包括:
ActivationChange
,
EnabledChange
,
FontChange
,
StyleChange
,
PaletteChange
,
ParentChange
,
LayoutDirectionChange
,和
ContentsRectChange
.
PySide2.QtWidgets.QGraphicsWidget.
close
(
)
¶
bool
Call this function to close the widget.
返回
true
若 Widget 被关闭;否则返回
false
. This slot will first send a
QCloseEvent
to the widget, which may or may not accept the event. If the event was ignored, nothing happens. If the event was accepted, it will
hide()
the widget.
若 Widget 拥有
WA_DeleteOnClose
attribute set it will be deleted.
PySide2.QtWidgets.QGraphicsWidget.
closeEvent
(
event
)
¶
event
–
QCloseEvent
This event handler, for
event
, can be reimplemented in a subclass to receive widget close events. The default implementation accepts the event.
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
focusNextPrevChild
(
next
)
¶
next
–
bool
bool
查找新的 Widget 以给予键盘聚焦,如适合 Tab 和 Shift+Tab,并返回
true
if it can find a new widget; returns
false
otherwise. If
next
is true, this function searches forward; if
next
为 False,向后搜索。
Sometimes, you will want to reimplement this function to provide special focus handling for your widget and its subwidgets. For example, a web browser might reimplement it to move its current active link forward or backward, and call the base implementation only when it reaches the last or first link on the page.
Child widgets call on their parent widgets, but only the window that contains the child widgets decides where to redirect focus. By reimplementing this function for an object, you gain control of focus traversal for all child widgets.
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
focusPolicy
(
)
¶
FocusPolicy
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
focusWidget
(
)
¶
If this widget, a child or descendant of this widget currently has input focus, this function will return a pointer to that widget. If no descendant widget has input focus,
None
被返回。
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
geometryChanged
(
)
¶
PySide2.QtWidgets.QGraphicsWidget.
getWindowFrameMargins
(
)
¶
Gets the widget’s window frame margins. The margins are stored in
left
,
top
,
right
and
bottom
as pointers to qreals. Each argument can be
omitted
by passing
None
.
PySide2.QtWidgets.QGraphicsWidget.
grabKeyboardEvent
(
event
)
¶
event
–
QEvent
This event handler, for
event
, can be reimplemented in a subclass to receive notifications for
GrabKeyboard
事件。
另请参阅
grabKeyboard()
grabMouse()
PySide2.QtWidgets.QGraphicsWidget.
grabMouseEvent
(
event
)
¶
event
–
QEvent
This event handler, for
event
, can be reimplemented in a subclass to receive notifications for
GrabMouse
事件。
另请参阅
grabMouse()
grabKeyboard()
PySide2.QtWidgets.QGraphicsWidget.
grabShortcut
(
sequence
[
,
context=Qt.WindowShortcut
]
)
¶
sequence
–
QKeySequence
context
–
ShortcutContext
int
Adds a shortcut to Qt’s shortcut system that watches for the given key
sequence
以给定
context
。若
context
is
ApplicationShortcut
,快捷方式适用于整个应用程序。否则,要么本地到此 Widget,
WidgetShortcut
,或到窗口本身,
WindowShortcut
. For widgets that are not part of a window (i.e., top-level widgets and their children),
WindowShortcut
shortcuts apply to the scene.
If the same key
sequence
has been grabbed by several widgets, when the key
sequence
occurs a
Shortcut
event is sent to all the widgets to which it applies in a non-deterministic order, but with the ``ambiguous’’ flag set to true.
警告
通常不需要使用此函数;而是创建
QAction
s with the shortcut key sequences you require (if you also want equivalent menu options and toolbar buttons), or create
QShortcut
s if you just need key sequences. Both
QAction
and
QShortcut
handle all the event filtering for you, and provide signals which are triggered when the user triggers the key sequence, so are much easier to use than this low-level function.
PySide2.QtWidgets.QGraphicsWidget.
hideEvent
(
event
)
¶
event
–
QHideEvent
This event handler, for
Hide
events, is delivered after the widget has been hidden, for example,
setVisible
(false) has been called for the widget or one of its ancestors when the widget was previously shown.
You can reimplement this event handler to detect when your widget is hidden. Calling
accept()
or
ignore()
on
event
不起作用。
另请参阅
showEvent()
hideEvent()
ItemVisibleChange
PySide2.QtWidgets.QGraphicsWidget.
initStyleOption
(
option
)
¶
option
–
QStyleOption
Populates a style option object for this widget based on its current state, and stores the output in
option
. The default implementation populates
option
with the following properties.
|
Style Option Property |
值 |
|
state &
|
Corresponds to
|
|
state &
|
Corresponds to
|
|
state &
|
Corresponds to
|
|
direction |
Corresponds to
|
|
rect |
Corresponds to
|
|
palette |
Corresponds to
|
|
fontMetrics |
Corresponds to
|
子类化的
QGraphicsWidget
should call the base implementation, and then test the type of
option
使用
qstyleoption_cast
<>() or test
Type
before storing widget-specific options.
例如:
class MyGroupBoxWidget (QStyleOptionGroupBox):
# ...
def initStyleOption(option):
QGraphicsWidget.initStyleOption(self, option)
if isinstance(option, QStyleOptionGroupBox):
# Add group box specific state.
box.flat = isFlat()
# ...
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
insertAction
(
before
,
action
)
¶
插入动作
action
to this widget’s list of actions, before the action
before
。它追加动作,若
before
is
None
or
before
不是有效动作 (对于此 Widget)。
A QGraphicsWidget 每动作只应有一个。
PySide2.QtWidgets.QGraphicsWidget.
insertActions
(
before
,
actions
)
¶
before
–
QAction
actions –
插入动作
actions
to this widget’s list of actions, before the action
before
。它追加动作,若
before
is
None
or
before
不是有效动作 (对于此 Widget)。
A QGraphicsWidget 每动作最多能有一个。
PySide2.QtWidgets.QGraphicsWidget.
isActiveWindow
(
)
¶
bool
返回
true
if this widget’s window is in the active window, or if the widget does not have a window but is in an active scene (i.e., a scene that currently has focus).
The active window is the window that either contains a child widget that currently has input focus, or that itself has input focus.
另请参阅
activeWindow()
setActiveWindow()
isActive()
PySide2.QtWidgets.QGraphicsWidget.
layout
(
)
¶
Returns this widget’s layout, or
None
if no layout is currently managing this widget.
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
layoutChanged
(
)
¶
PySide2.QtWidgets.QGraphicsWidget.
layoutDirection
(
)
¶
LayoutDirection
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
moveEvent
(
event
)
¶
event
–
QGraphicsSceneMoveEvent
This event handler, for
GraphicsSceneMove
events, is delivered after the widget has moved (e.g., its local position has changed).
This event is only delivered when the item is moved locally. Calling
setTransform()
or moving any of the item’s ancestors does not affect the item’s local position.
You can reimplement this event handler to detect when your widget has moved. Calling
accept()
or
ignore()
on
event
不起作用。
另请参阅
ItemPositionChange
ItemPositionHasChanged
PySide2.QtWidgets.QGraphicsWidget.
paintWindowFrame
(
painter
,
option
[
,
widget=None
]
)
¶
painter
–
QPainter
option
–
QStyleOptionGraphicsItem
widget
–
QWidget
此虚拟函数被调用由
QGraphicsScene
to draw the window frame for windows using
painter
,
option
,和
widget
, in local coordinates. The base implementation uses the current style to render the frame and title bar.
You can reimplement this function in a subclass of QGraphicsWidget to provide custom rendering of the widget’s window frame.
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
palette
(
)
¶
QPalette
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
polishEvent
(
)
¶
This event is delivered to the item by the scene at some point after it has been constructed, but before it is shown or otherwise accessed through the scene. You can use this event handler to do last-minute initializations of the widget which require the item to be fully constructed.
The base implementation does nothing.
PySide2.QtWidgets.QGraphicsWidget.
propertyChange
(
propertyName
,
value
)
¶
propertyName – unicode
value – object
object
This virtual function is used to notify changes to any property (both dynamic properties, and registered with
Q_PROPERTY
) in the widget. Depending on the property itself, the notification can be delivered before or after the value has changed.
propertyName
is the name of the property (e.g., “size” or “font”), and
value
is the (proposed) new value of the property. The function returns the new value, which may be different from
value
if the notification supports adjusting the property value. The base implementation simply returns
value
for any
propertyName
.
QGraphicsWidget delivers notifications for the following properties:
|
propertyName |
特性 |
|
size |
|
|
font |
|
|
palette |
另请参阅
itemChange()
PySide2.QtWidgets.QGraphicsWidget.
rect
(
)
¶
QRectF
Returns the item’s local rect as a
QRectF
. This function is equivalent to
QRectF
(QPointF(),
size()
).
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
releaseShortcut
(
id
)
¶
id
–
int
删除快捷方式采用给定
id
from Qt’s shortcut system. The widget will no longer receive
Shortcut
events for the shortcut’s key sequence (unless it has other shortcuts with the same key sequence).
警告
You should not normally need to use this function since Qt’s shortcut system removes shortcuts automatically when their parent widget is destroyed. It is best to use
QAction
or
QShortcut
to handle shortcuts, since they are easier to use than this low-level function. Note also that this is an expensive operation.
PySide2.QtWidgets.QGraphicsWidget.
removeAction
(
action
)
¶
action
–
QAction
移除动作
action
from this widget’s list of actions.
PySide2.QtWidgets.QGraphicsWidget.
resize
(
size
)
¶
size
–
QSizeF
PySide2.QtWidgets.QGraphicsWidget.
resize
(
w
,
h
)
¶
w
–
qreal
h
–
qreal
这是重载函数。
Constructs a resize with the given
width
(
w
) and
height
(
h
). This convenience function is equivalent to calling resize(
QSizeF
(w, h)).
另请参阅
setGeometry()
setTransform()
PySide2.QtWidgets.QGraphicsWidget.
resizeEvent
(
event
)
¶
event
–
QGraphicsSceneResizeEvent
This event handler, for
GraphicsSceneResize
events, is delivered after the widget has been resized (i.e., its local size has changed).
event
contains both the old and the new size.
This event is only delivered when the widget is resized locally; calling
setTransform()
on the widget or any of its ancestors or view, does not affect the widget’s local size.
You can reimplement this event handler to detect when your widget has been resized. Calling
accept()
or
ignore()
on
event
不起作用。
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
setAttribute
(
attribute
[
,
on=true
]
)
¶
attribute
–
WidgetAttribute
on
–
bool
若
on
is true, this function enables
attribute
;否则
attribute
是禁用的。
See the class documentation for QGraphicsWidget for a complete list of which attributes are supported, and what they are for.
PySide2.QtWidgets.QGraphicsWidget.
setAutoFillBackground
(
enabled
)
¶
enabled
–
bool
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
setContentsMargins
(
margins
)
¶
margins
–
QMarginsF
Sets the widget’s contents margins to
margins
.
Contents margins are used by the assigned layout to define the placement of subwidgets and layouts. Margins are particularly useful for widgets that constrain subwidgets to only a section of its own geometry. For example, a group box with a layout will place subwidgets inside its frame, but below the title.
Changing a widget’s contents margins will always trigger an
update()
, and any assigned layout will be activated automatically. The widget will then receive a
ContentsRectChange
事件。
另请参阅
getContentsMargins()
setGeometry()
PySide2.QtWidgets.QGraphicsWidget.
setContentsMargins
(
left
,
top
,
right
,
bottom
)
¶
left
–
qreal
top
–
qreal
right
–
qreal
bottom
–
qreal
这是重载函数。
Sets the widget’s contents margins to
left
,
top
,
right
and
bottom
.
PySide2.QtWidgets.QGraphicsWidget.
setFocusPolicy
(
policy
)
¶
policy
–
FocusPolicy
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
setGeometry
(
x
,
y
,
w
,
h
)
¶
x
–
qreal
y
–
qreal
w
–
qreal
h
–
qreal
This convenience function is equivalent to calling
setGeometry
(
QRectF
(
x
,
y
,
w
,
h
)).
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
setLayout
(
layout
)
¶
layout
–
QGraphicsLayout
Sets the layout for this widget to
layout
. Any existing layout manager is deleted before the new layout is assigned. If
layout
is
None
, the widget is left without a layout. Existing subwidgets’ geometries will remain unaffected.
All widgets that are currently managed by
layout
or all of its sublayouts, are automatically reparented to this item. The layout is then invalidated, and the child widget geometries are adjusted according to this item’s
geometry()
and contentsMargins(). Children who are not explicitly managed by
layout
remain unaffected by the layout after it has been assigned to this widget.
QGraphicsWidget
takes ownership of
layout
.
PySide2.QtWidgets.QGraphicsWidget.
setLayoutDirection
(
direction
)
¶
direction
–
LayoutDirection
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
setShortcutAutoRepeat
(
id
[
,
enabled=true
]
)
¶
id
–
int
enabled
–
bool
若
enabled
is true, auto repeat of the shortcut with the given
id
被启用;否则它被禁用。
PySide2.QtWidgets.QGraphicsWidget.
setShortcutEnabled
(
id
[
,
enabled=true
]
)
¶
id
–
int
enabled
–
bool
若
enabled
为 True,快捷方式采用给定
id
被启用;否则快捷方式被禁用。
PySide2.QtWidgets.QGraphicsWidget.
setStyle
(
style
)
¶
style
–
QStyle
Sets the widget’s style to
style
.
QGraphicsWidget
does
not
take ownership of
style
.
If no style is assigned, or
style
is
None
, the widget will use
style()
(if this has been set). Otherwise the widget will use
style()
.
此函数设置
WA_SetStyle
attribute if
style
不是
None
; otherwise it clears the attribute.
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
setTabOrder
(
first
,
second
)
¶
first
–
QGraphicsWidget
second
–
QGraphicsWidget
Moves the
second
widget around the ring of focus widgets so that keyboard focus moves from the
first
widget to the
second
widget when the Tab key is pressed.
Note that since the tab order of the
second
widget is changed, you should order a chain like this:
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
若
first
is
None
, this indicates that
second
should be the first widget to receive input focus should the scene gain Tab focus (i.e., the user hits Tab so that focus passes into the scene). If
second
is
None
, this indicates that
first
should be the first widget to gain focus if the scene gained BackTab focus.
By default, tab order is defined implicitly using widget creation order.
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
setWindowFlags
(
wFlags
)
¶
wFlags
–
WindowFlags
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
setWindowFrameMargins
(
margins
)
¶
margins
–
QMarginsF
Sets the widget’s window frame margins to
margins
. The default frame margins are provided by the style, and they depend on the current window flags.
If you would like to draw your own window decoration, you can set your own frame margins to override the default margins.
PySide2.QtWidgets.QGraphicsWidget.
setWindowFrameMargins
(
left
,
top
,
right
,
bottom
)
¶
left
–
qreal
top
–
qreal
right
–
qreal
bottom
–
qreal
这是重载函数。
Sets the widget’s window frame margins to
left
,
top
,
right
and
bottom
.
PySide2.QtWidgets.QGraphicsWidget.
setWindowTitle
(
title
)
¶
title – unicode
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
showEvent
(
event
)
¶
event
–
QShowEvent
This event handler, for
Show
events, is delivered before the widget has been shown, for example,
setVisible
(true) has been called for the widget or one of its ancestors when the widget was previously hidden.
You can reimplement this event handler to detect when your widget is shown. Calling
accept()
or
ignore()
on
event
不起作用。
另请参阅
hideEvent()
showEvent()
ItemVisibleChange
PySide2.QtWidgets.QGraphicsWidget.
size
(
)
¶
QSizeF
PySide2.QtWidgets.QGraphicsWidget.
style
(
)
¶
Returns a pointer to the widget’s style. If this widget does not have any explicitly assigned style, the scene’s style is returned instead. In turn, if the scene does not have any assigned style, this function returns
style()
.
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
testAttribute
(
attribute
)
¶
attribute
–
WidgetAttribute
bool
返回
true
if
attribute
is enabled for this widget; otherwise, returns
false
.
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
ungrabKeyboardEvent
(
event
)
¶
event
–
QEvent
This event handler, for
event
, can be reimplemented in a subclass to receive notifications for
UngrabKeyboard
事件。
另请参阅
ungrabKeyboard()
ungrabMouse()
PySide2.QtWidgets.QGraphicsWidget.
ungrabMouseEvent
(
event
)
¶
event
–
QEvent
This event handler, for
event
, can be reimplemented in a subclass to receive notifications for
UngrabMouse
事件。
另请参阅
ungrabMouse()
ungrabKeyboard()
PySide2.QtWidgets.QGraphicsWidget.
unsetLayoutDirection
(
)
¶
PySide2.QtWidgets.QGraphicsWidget.
unsetWindowFrameMargins
(
)
¶
Resets the window frame margins to the default value, provided by the style.
PySide2.QtWidgets.QGraphicsWidget.
windowFlags
(
)
¶
WindowFlags
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
windowFrameEvent
(
e
)
¶
e
–
QEvent
bool
This event handler, for
event
, receives events for the window frame if this widget is a window. Its base implementation provides support for default window frame interaction such as moving, resizing, etc.
You can reimplement this handler in a subclass of QGraphicsWidget to provide your own custom window frame interaction support.
返回
true
if
event
已被识别并处理;否则,返回
false
.
另请参阅
event()
PySide2.QtWidgets.QGraphicsWidget.
windowFrameGeometry
(
)
¶
QRectF
Returns the widget’s geometry in parent coordinates including any window frame.
PySide2.QtWidgets.QGraphicsWidget.
windowFrameRect
(
)
¶
QRectF
Returns the widget’s local rect including any window frame.
PySide2.QtWidgets.QGraphicsWidget.
windowFrameSectionAt
(
pos
)
¶
pos
–
QPointF
WindowFrameSection
Returns the window frame section at position
pos
,或
NoSection
if there is no window frame section at this position.
This function is used in QGraphicsWidget ‘s base implementation for window frame interaction.
You can reimplement this function if you want to customize how a window can be interactively moved or resized. For instance, if you only want to allow a window to be resized by the bottom right corner, you can reimplement this function to return
NoSection
for all sections except
BottomRightSection
.
PySide2.QtWidgets.QGraphicsWidget.
windowTitle
(
)
¶
unicode
另请参阅
PySide2.QtWidgets.QGraphicsWidget.
windowType
(
)
¶
WindowType
Returns the widgets window type.
另请参阅
windowFlags()
isWindow()
isPanel()