QWindow

QWindow class represents a window in the underlying windowing system. 更多

Inheritance diagram of PySide2.QtGui.QWindow

继承者: Qt3DExtras.Qt3DWindow , QtDataVisualization.Q3DBars , QtDataVisualization.Q3DScatter , QtDataVisualization.Q3DSurface , QtDataVisualization.QAbstract3DGraph , QOpenGLWindow , QPaintDeviceWindow , QRasterWindow , QQuickView , QQuickWindow

概要

函数

虚函数

静态函数

详细描述

由父级提供的窗口,将变为其父级窗口的本机子级窗口。

应用程序通常会使用 QWidget or QQuickView for its UI, and not QWindow directly. Still, it is possible to render directly to a QWindow with QBackingStore or QOpenGLContext ,当希望把依赖关系降到最低 (或想要直接使用 OpenGL) 时。 光栅窗口范例 and OpenGL 窗口范例 are useful reference examples for how to render to a QWindow using either approach.

资源管理

Windows can potentially use a lot of memory. A usual measurement is width times height times color depth. A window might also include multiple buffers to support double and triple buffering, as well as depth and stencil buffers. To release a window’s memory resources, call the destroy() 函数。

内容取向

QWindow has reportContentOrientationChange() that can be used to specify the layout of the window contents in relation to the screen. The content orientation is simply a hint to the windowing system about which orientation the window contents are in. It’s useful when you wish to keep the same window size, but rotate the contents instead, especially when doing rotation animations between different orientations. The windowing system might use this value to determine the layout of system popups or dialogs.

可见性和窗口系统曝光

By default, the window is not visible, and you must call setVisible (true), or show() or similar to make it visible. To make a window hidden again, call setVisible (false) or hide() . The visible property describes the state the application wants the window to be in. Depending on the underlying system, a visible window might still not be shown on the screen. It could, for instance, be covered by other opaque windows or moved outside the physical area of the screen. On windowing systems that have exposure notifications, the isExposed() accessor describes whether the window should be treated as directly visible on screen. The exposeEvent() function is called whenever an area of the window is invalidated, for example due to the exposure in the windowing system changing. On windowing systems that do not make this information visible to the application, isExposed() will simply return the same value as isVisible() .

Visibility queried through visibility() is a convenience API combining the functions of visible() and windowStates() .

渲染

There are two Qt APIs that can be used to render content into a window, QBackingStore for rendering with a QPainter and flushing the contents to a window with type RasterSurface ,和 QOpenGLContext for rendering with OpenGL to a window with type OpenGLSurface .

The application can start rendering as soon as isExposed() 返回 true , and can keep rendering until it isExposed() 返回 false . To find out when isExposed() changes, reimplement exposeEvent() . The window will always get a resize event before the first expose event.

初始几何体

If the window’s width and height are left uninitialized, the window will get a reasonable default geometry from the platform window. If the position is left uninitialized, then the platform window will allow the windowing system to position the window. For example on X11, the window manager usually does some kind of smart positioning to try to avoid having new windows completely obscure existing windows. However setGeometry() initializes both the position and the size, so if you want a fixed size but an automatic position, you should call resize() or setWidth() and setHeight() 代替。

class QWindow ( [ screen=None ] )

QWindow(parent)

param parent

QWindow

param screen

QScreen

创建顶层窗口,在 targetScreen .

窗口不被展示直到 setVisible (true), show() , or similar is called.

另请参阅

setScreen()

创建窗口作为子级,为给定 parent 窗口。

窗口会被嵌入在父级窗口内,其坐标相对于父级。

屏幕继承自父级。

另请参阅

setParent()

PySide2.QtGui.QWindow. Visibility

This enum describes what part of the screen the window occupies or should occupy.

常量

描述

QWindow.Windowed

The window occupies part of the screen, but not necessarily the entire screen. This state will occur only on windowing systems which support showing multiple windows simultaneously. In this state it is possible for the user to move and resize the window manually, if WindowFlags permit it and if it is supported by the windowing system.

QWindow.Minimized

The window is reduced to an entry or icon on the task bar, dock, task list or desktop, depending on how the windowing system handles minimized windows.

QWindow.Maximized

The window occupies one entire screen, and the titlebar is still visible. On most windowing systems this is the state achieved by clicking the maximize button on the toolbar.

QWindow.FullScreen

The window occupies one entire screen, is not resizable, and there is no titlebar. On some platforms which do not support showing multiple simultaneous windows, this can be the usual visibility when the window is not hidden.

QWindow.AutomaticVisibility

This means to give the window a default visible state, which might be fullscreen or windowed depending on the platform. It can be given as a parameter to setVisibility but will never be read back from the visibility accessor.

QWindow.Hidden

The window is not visible in any way, however it may remember a latent visibility which can be restored by setting .

PySide2.QtGui.QWindow. AncestorMode

This enum is used to control whether or not transient parents should be considered ancestors.

常量

描述

QWindow.ExcludeTransients

Transient parents are not considered ancestors.

QWindow.IncludeTransients

Transient parents are considered ancestors.

PySide2.QtGui.QWindow. accessibleRoot ( )
返回类型

QAccessibleInterface

Returns the accessibility interface for the object that the window represents

另请参阅

QAccessible

PySide2.QtGui.QWindow. activeChanged ( )
PySide2.QtGui.QWindow. alert ( msec )
参数

msec int

Causes an alert to be shown for msec miliseconds. If msec is 0 (the default), then the alert is shown indefinitely until the window becomes active again. This function has no effect on an active window.

In alert state, the window indicates that it demands attention, for example by flashing or bouncing the taskbar entry.

PySide2.QtGui.QWindow. baseSize ( )
返回类型

QSize

返回窗口的基尺寸。

另请参阅

setBaseSize()

PySide2.QtGui.QWindow. close ( )
返回类型

bool

关闭窗口。

This closes the window, effectively calling destroy() , and potentially quitting the application. Returns true on success, false if it has a parent window (in which case the top level window should be closed instead).

PySide2.QtGui.QWindow. contentOrientation ( )
返回类型

ScreenOrientation

PySide2.QtGui.QWindow. contentOrientationChanged ( orientation )
参数

orientation ScreenOrientation

PySide2.QtGui.QWindow. create ( )

Allocates the platform resources associated with the window.

It is at this point that the surface format set using setFormat() gets resolved into an actual native surface. However, the window remains hidden until setVisible() 被调用。

Note that it is not usually necessary to call this function directly, as it will be implicitly called by show() , setVisible() , and other functions that require access to the platform resources.

调用 destroy() to free the platform resources if necessary.

另请参阅

destroy()

PySide2.QtGui.QWindow. cursor ( )
返回类型

QCursor

用于此窗口的光标形状

PySide2.QtGui.QWindow. destroy ( )

释放关联此窗口的本机平台资源。

另请参阅

create()

PySide2.QtGui.QWindow. devicePixelRatio ( )
返回类型

qreal

Returns the ratio between physical pixels and device-independent pixels for the window. This value is dependent on the screen the window is on, and may change when the window is moved.

Common values are 1.0 on normal displays and 2.0 on Apple “retina” displays.

注意

For windows not backed by a platform window, meaning that create() was not called, the function will fall back to the associated QScreen ‘s device pixel ratio.

PySide2.QtGui.QWindow. exposeEvent ( arg__1 )
参数

arg__1 QExposeEvent

曝光事件 ( ev ) 被发送通过窗口系统,每当窗口区域无效时 (例如:由于窗口系统改变曝光)。

应用程序可以开始渲染到窗口,采用 QBackingStore and QOpenGLContext as soon as it gets an such that isExposed() 为 true。

若窗口被移出屏幕,使之完全被另一窗口、图标化或类似窗口所掩盖,此函数可能被调用,且值 isExposed() might change to false. When this happens, an application should stop its rendering as it is no longer visible to the user.

Resize (重置尺寸) 事件将始终被发送,在窗口首次被展示的曝光事件之前。

另请参阅

isExposed()

PySide2.QtGui.QWindow. filePath ( )
返回类型

unicode

表示此窗口的文件名。

另请参阅

setFilePath()

PySide2.QtGui.QWindow. flags ( )
返回类型

WindowFlags

另请参阅

setFlags()

PySide2.QtGui.QWindow. focusInEvent ( arg__1 )
参数

arg__1 QFocusEvent

覆盖此以处理聚焦入事件 ( ev ).

Focus in events are sent when the window receives keyboard focus.

另请参阅

focusOutEvent()

PySide2.QtGui.QWindow. focusObject ( )
返回类型

QObject

返回 QObject that will be the final receiver of events tied focus, such as key events.

PySide2.QtGui.QWindow. focusObjectChanged ( object )
参数

object QObject

PySide2.QtGui.QWindow. focusOutEvent ( arg__1 )
参数

arg__1 QFocusEvent

覆盖此以处理聚焦出事件 ( ev ).

Focus out events are sent when the window loses keyboard focus.

另请参阅

focusInEvent()

PySide2.QtGui.QWindow. frameGeometry ( )
返回类型

QRect

Returns the geometry of the window, including its window frame.

The geometry is in relation to the virtualGeometry() of its screen.

PySide2.QtGui.QWindow. frameMargins ( )
返回类型

QMargins

Returns the window frame margins surrounding the window.

PySide2.QtGui.QWindow. framePosition ( )
返回类型

QPoint

Returns the top left position of the window, including its window frame.

This returns the same value as frameGeometry() . topLeft() .

static PySide2.QtGui.QWindow. fromWinId ( id )
参数

id WId

返回类型

QWindow

创建由另一进程 (或由使用 Qt 下本机库) 创建的窗口的本地表示。

给定句柄 id 到本机窗口,此方法创建 QWindow 对象,其可以被用于表示窗口,当援引方法像 setParent() and .

这可以在支持它的平台上使用,以嵌入 QWindow 在本机窗口,或把本机窗口嵌入在 QWindow .

若外来窗口不被支持,或在平台插件中嵌入本机窗口失败,此函数返回 None .

注意

结果 QWindow 不应用于操纵底层本机窗口 (除重新父级化外),或用于观察本机窗口的状态变化。对这类操作的任何支持都是偶然的,高度依赖平台且未经测试。

另请参阅

setParent()

PySide2.QtGui.QWindow. geometry ( )
返回类型

QRect

Returns the geometry of the window, excluding its window frame.

The geometry is in relation to the virtualGeometry() of its screen.

PySide2.QtGui.QWindow. height ( )
返回类型

int

另请参阅

setHeight()

PySide2.QtGui.QWindow. heightChanged ( arg )
参数

arg int

PySide2.QtGui.QWindow. hide ( )

隐藏窗口。

相当于调用 setVisible (false).

PySide2.QtGui.QWindow. hideEvent ( arg__1 )
参数

arg__1 QHideEvent

Override this to handle hide events ( ev ).

The function is called when the window has requested being hidden in the windowing system.

PySide2.QtGui.QWindow. icon ( )
返回类型

QIcon

Returns the window’s icon in the windowing system

另请参阅

setIcon()

PySide2.QtGui.QWindow. isActive ( )
返回类型

bool

返回 true if the window should appear active from a style perspective.

This is the case for the window that has input focus as well as windows that are in the same parent / transient parent chain as the focus window.

To get the window that currently has focus, use focusWindow() .

PySide2.QtGui.QWindow. isAncestorOf ( child [ , mode=IncludeTransients ] )
参数
返回类型

bool

返回 true if the window is an ancestor of the given child 。若 mode is IncludeTransients , then transient parents are also considered ancestors.

PySide2.QtGui.QWindow. isExposed ( )
返回类型

bool

Returns if this window is exposed in the windowing system.

When the window is not exposed, it is shown by the application but it is still not showing in the windowing system, so the application should minimize rendering and other graphical activities.

An exposeEvent() is sent every time this value changes.

另请参阅

exposeEvent()

PySide2.QtGui.QWindow. isModal ( )
返回类型

bool

Returns whether the window is modal.

A modal window prevents other windows from getting any input.

另请参阅

modality

PySide2.QtGui.QWindow. isTopLevel ( )
返回类型

bool

Returns whether the window is top level, i.e. has no parent window.

PySide2.QtGui.QWindow. isVisible ( )
返回类型

bool

PySide2.QtGui.QWindow. keyPressEvent ( arg__1 )
参数

arg__1 QKeyEvent

Override this to handle key press events ( ev ).

另请参阅

keyReleaseEvent()

PySide2.QtGui.QWindow. keyReleaseEvent ( arg__1 )
参数

arg__1 QKeyEvent

Override this to handle key release events ( ev ).

另请参阅

keyPressEvent()

PySide2.QtGui.QWindow. lower ( )

降低窗口系统中的窗口。

请求降低窗口将出现在其它窗口下方。

PySide2.QtGui.QWindow. mapFromGlobal ( pos )
参数

pos QPoint

返回类型

QPoint

翻译全局屏幕坐标 pos to window coordinates.

另请参阅

mapToGlobal()

PySide2.QtGui.QWindow. mapToGlobal ( pos )
参数

pos QPoint

返回类型

QPoint

Translates the window coordinate pos 到全局屏幕坐标。例如: mapToGlobal(QPoint(0,0)) would give the global coordinates of the top-left pixel of the window.

另请参阅

mapFromGlobal()

PySide2.QtGui.QWindow. mask ( )
返回类型

QRegion

Returns the mask set on the window.

The mask is a hint to the windowing system that the application does not want to receive mouse or touch input outside the given region.

另请参阅

setMask()

PySide2.QtGui.QWindow. maximumHeight ( )
返回类型

int

PySide2.QtGui.QWindow. maximumHeightChanged ( arg )
参数

arg int

PySide2.QtGui.QWindow. maximumSize ( )
返回类型

QSize

Returns the maximum size of the window.

另请参阅

setMaximumSize()

PySide2.QtGui.QWindow. maximumWidth ( )
返回类型

int

另请参阅

setMaximumWidth()

PySide2.QtGui.QWindow. maximumWidthChanged ( arg )
参数

arg int

PySide2.QtGui.QWindow. minimumHeight ( )
返回类型

int

PySide2.QtGui.QWindow. minimumHeightChanged ( arg )
参数

arg int

PySide2.QtGui.QWindow. minimumSize ( )
返回类型

QSize

Returns the minimum size of the window.

另请参阅

setMinimumSize()

PySide2.QtGui.QWindow. minimumWidth ( )
返回类型

int

另请参阅

setMinimumWidth()

PySide2.QtGui.QWindow. minimumWidthChanged ( arg )
参数

arg int

PySide2.QtGui.QWindow. modality ( )
返回类型

WindowModality

另请参阅

setModality()

PySide2.QtGui.QWindow. modalityChanged ( modality )
参数

modality WindowModality

PySide2.QtGui.QWindow. mouseDoubleClickEvent ( arg__1 )
参数

arg__1 QMouseEvent

Override this to handle mouse double click events ( ev ).

PySide2.QtGui.QWindow. mouseMoveEvent ( arg__1 )
参数

arg__1 QMouseEvent

Override this to handle mouse move events ( ev ).

PySide2.QtGui.QWindow. mousePressEvent ( arg__1 )
参数

arg__1 QMouseEvent

Override this to handle mouse press events ( ev ).

PySide2.QtGui.QWindow. mouseReleaseEvent ( arg__1 )
参数

arg__1 QMouseEvent

Override this to handle mouse release events ( ev ).

另请参阅

mousePressEvent()

PySide2.QtGui.QWindow. moveEvent ( arg__1 )
参数

arg__1 QMoveEvent

Override this to handle window move events ( ev ).

PySide2.QtGui.QWindow. nativeEvent ( eventType , message )
参数
  • eventType QByteArray

  • message void

返回类型

PyObject

Override this to handle platform dependent events. Will be given eventType , message and result .

This might make your application non-portable.

Should return true only if the event was handled.

PySide2.QtGui.QWindow. opacity ( )
返回类型

qreal

另请参阅

setOpacity()

PySide2.QtGui.QWindow. opacityChanged ( opacity )
参数

opacity qreal

PySide2.QtGui.QWindow. parent ( mode )
参数

mode AncestorMode

返回类型

QWindow

Returns the parent window, if any.

mode is IncludeTransients , then the transient parent is returned if there is no parent.

A window without a parent is known as a top level window.

另请参阅

setParent()

PySide2.QtGui.QWindow. position ( )
返回类型

QPoint

Returns the position of the window on the desktop excluding any window frame

另请参阅

setPosition()

PySide2.QtGui.QWindow. raise_ ( )

在窗口系统中提升窗口。

请求提升窗口将出现在其它窗口上方。

PySide2.QtGui.QWindow. reportContentOrientationChange ( orientation )
参数

orientation ScreenOrientation

PySide2.QtGui.QWindow. requestActivate ( )

请求窗口被激活,即:接收键盘聚焦。

另请参阅

isActive() focusWindow() setWindowActivationBehavior()

PySide2.QtGui.QWindow. requestUpdate ( )

Schedules a UpdateRequest event to be delivered to this window.

The event is delivered in sync with the display vsync on platforms where this is possible. Otherwise, the event is delivered after a delay of 5 ms. The additional time is there to give the event loop a bit of idle time to gather system events, and can be overridden using the QT_QPA_UPDATE_IDLE_TIME environment variable.

When driving animations, this function should be called once after drawing has completed. Calling this function multiple times will result in a single event being delivered to the window.

子类化的 QWindow should reimplement event() , intercept the event and call the application’s rendering code, then call the base class implementation.

注意

The subclass’ reimplementation of event() must invoke the base class implementation, unless it is absolutely sure that the event does not need to be handled by the base class. For example, the default implementation of this function relies on Timer events. Filtering them away would therefore break the delivery of the update events.

PySide2.QtGui.QWindow. requestedFormat ( )
返回类型

QSurfaceFormat

Returns the requested surface format of this window.

If the requested format was not supported by the platform implementation, the will differ from the actual window format.

This is the value set with setFormat() .

另请参阅

setFormat() format()

PySide2.QtGui.QWindow. resize ( newSize )
参数

newSize QSize

set the size of the window, excluding any window frame, to newSize

另请参阅

size() geometry()

PySide2.QtGui.QWindow. resize ( w , h )
参数
  • w int

  • h int

set the size of the window, excluding any window frame, to a QSize constructed from width w and height h

For interactively resizing windows, see startSystemResize() .

另请参阅

size() geometry()

PySide2.QtGui.QWindow. resizeEvent ( arg__1 )
参数

arg__1 QResizeEvent

Override this to handle resize events ( ev ).

The resize event is called whenever the window is resized in the windowing system, either directly through the windowing system acknowledging a setGeometry() or resize() request, or indirectly through the user resizing the window manually.

PySide2.QtGui.QWindow. screen ( )
返回类型

QScreen

返回在其中展示窗口的屏幕,或 null 若没有的话。

对于子级窗口,这返回相应顶层窗口屏幕。

PySide2.QtGui.QWindow. screenChanged ( screen )
参数

screen QScreen

PySide2.QtGui.QWindow. setBaseSize ( size )
参数

size QSize

Sets the base size of the window.

The base size is used to calculate a proper window size if the window defines sizeIncrement() .

PySide2.QtGui.QWindow. setCursor ( arg__1 )
参数

arg__1 QCursor

set the cursor shape for this window

The mouse cursor will assume this shape when it is over this window, unless an override cursor is set. See the list of predefined cursor 对象 了解有用形状范围。

If no cursor has been set, or after a call to unsetCursor() , the parent window’s cursor is used.

By default, the cursor has the ArrowCursor 形状。

Some underlying window implementations will reset the cursor if it leaves a window even if the mouse is grabbed. If you want to have a cursor set for all windows, even when outside the window, consider setOverrideCursor() .

PySide2.QtGui.QWindow. setFilePath ( filePath )
参数

filePath – unicode

set the file name this window is representing.

The windowing system might use filePath to display the path of the document this window is representing in the tile bar.

另请参阅

filePath()

PySide2.QtGui.QWindow. setFlag ( arg__1 [ , on=true ] )
参数
  • arg__1 WindowType

  • on bool

设置窗口标志 flag on this window if on 为 true;否则清零标志。

PySide2.QtGui.QWindow. setFlags ( flags )
参数

flags WindowFlags

另请参阅

flags()

PySide2.QtGui.QWindow. setFormat ( format )
参数

format QSurfaceFormat

Sets the window’s surface format .

The format determines properties such as color depth, alpha, depth and stencil buffer size, etc. For example, to give a window a transparent background (provided that the window system supports compositing, and provided that other content in the window does not make it opaque again):

QSurfaceFormat format;
format.setAlphaBufferSize(8);
window.setFormat(format);
												

The surface format will be resolved in the create() function. Calling this function after create() has been called will not re-resolve the surface format of the native surface.

When the format is not explicitly set via this function, the format returned by defaultFormat() will be used. This means that when having multiple windows, individual calls to this function can be replaced by one single call to setDefaultFormat() before creating the first window.

PySide2.QtGui.QWindow. setFramePosition ( point )
参数

point QPoint

Sets the upper left position of the window ( point ) including its window frame.

位置与其屏幕的 virtualGeometry() 有关。

PySide2.QtGui.QWindow. setGeometry ( rect )
参数

rect QRect

Sets the geometry of the window, excluding its window frame, to rect .

The geometry is in relation to the virtualGeometry() of its screen.

另请参阅

geometry()

PySide2.QtGui.QWindow. setGeometry ( posx , posy , w , h )
参数
  • posx int

  • posy int

  • w int

  • h int

Sets the geometry of the window, excluding its window frame, to a rectangle constructed from posx , posy , w and h .

The geometry is in relation to the virtualGeometry() of its screen.

另请参阅

geometry()

PySide2.QtGui.QWindow. setHeight ( arg )
参数

arg int

另请参阅

height()

PySide2.QtGui.QWindow. setIcon ( icon )
参数

icon QIcon

Sets the window’s icon in the windowing system

The window icon might be used by the windowing system for example to decorate the window, and/or in the task switcher.

注意

On macOS, the window title bar icon is meant for windows representing documents, and will only show up if a file path is also set.

PySide2.QtGui.QWindow. setKeyboardGrabEnabled ( grab )
参数

grab bool

返回类型

bool

Sets whether keyboard grab should be enabled or not ( grab ).

If the return value is true, the window receives all key events until (false) is called; other windows get no key events at all. Mouse events are not affected. Use setMouseGrabEnabled() if you want to grab that.

PySide2.QtGui.QWindow. setMask ( region )
参数

region QRegion

Sets the mask of the window.

The mask is a hint to the windowing system that the application does not want to receive mouse or touch input outside the given region .

The window manager may or may not choose to display any areas of the window not included in the mask, thus it is the application’s responsibility to clear to transparent the areas that are not part of the mask.

另请参阅

mask()

PySide2.QtGui.QWindow. setMaximumHeight ( h )
参数

h int

另请参阅

maximumHeight()

PySide2.QtGui.QWindow. setMaximumSize ( size )
参数

size QSize

Sets the maximum size of the window.

This is a hint to the window manager to prevent resizing above the specified size .

PySide2.QtGui.QWindow. setMaximumWidth ( w )
参数

w int

另请参阅

maximumWidth()

PySide2.QtGui.QWindow. setMinimumHeight ( h )
参数

h int

另请参阅

minimumHeight()

PySide2.QtGui.QWindow. setMinimumSize ( size )
参数

size QSize

Sets the minimum size of the window.

This is a hint to the window manager to prevent resizing below the specified size .

PySide2.QtGui.QWindow. setMinimumWidth ( w )
参数

w int

另请参阅

minimumWidth()

PySide2.QtGui.QWindow. setModality ( modality )
参数

modality WindowModality

另请参阅

modality()

PySide2.QtGui.QWindow. setMouseGrabEnabled ( grab )
参数

grab bool

返回类型

bool

Sets whether mouse grab should be enabled or not ( grab ).

If the return value is true, the window receives all mouse events until (false) is called; other windows get no mouse events at all. Keyboard events are not affected. Use setKeyboardGrabEnabled() if you want to grab that.

PySide2.QtGui.QWindow. setOpacity ( level )
参数

level qreal

另请参阅

opacity()

PySide2.QtGui.QWindow. setParent ( parent )
参数

parent QWindow

设置 parent 窗口。这将导致窗口系统管理窗口的裁剪,因此,它将被裁剪到 parent 窗口。

设置 parent to be None 将使窗口成为顶层窗口。

parent 是窗口创建通过 fromWinId() , then the current window will be embedded inside parent ,若平台支持它。

另请参阅

parent()

PySide2.QtGui.QWindow. setPosition ( pt )
参数

pt QPoint

把窗口在桌面上的位置,设为 pt

位置与其屏幕的 virtualGeometry() 有关。

对于交互式移动窗口,见 startSystemMove() . For interactively resizing windows, see startSystemResize() .

PySide2.QtGui.QWindow. setPosition ( posx , posy )
参数
  • posx int

  • posy int

把窗口在桌面上的位置,设为 posx , posy

位置与其屏幕的 virtualGeometry() 有关。

另请参阅

position()

PySide2.QtGui.QWindow. setScreen ( screen )
参数

screen QScreen

Sets the screen on which the window should be shown.

If the window has been created, it will be recreated on the newScreen .

注意

若屏幕是多屏幕虚拟桌面的一部分,窗口不会自动移至 newScreen . To place the window relative to the screen, use the screen’s topLeft() position.

This function only works for top level windows.

PySide2.QtGui.QWindow. setSizeIncrement ( size )
参数

size QSize

Sets the size increment ( size ) of the window.

When the user resizes the window, the size will move in steps of sizeIncrement() . width() pixels horizontally and sizeIncrement() . height() pixels vertically, with baseSize() as the basis.

By default, this property contains a size with zero width and height.

The windowing system might not support size increments.

PySide2.QtGui.QWindow. setSurfaceType ( surfaceType )
参数

surfaceType SurfaceType

设置 surfaceType of the window.

Specifies whether the window is meant for raster rendering with QBackingStore , or OpenGL rendering with QOpenGLContext .

surfaceType will be used when the native surface is created in the create() function. Calling this function after the native surface has been created requires calling destroy() and create() to release the old native surface and create a new one.

PySide2.QtGui.QWindow. setTitle ( arg__1 )
参数

arg__1 – unicode

另请参阅

title()

PySide2.QtGui.QWindow. setTransientParent ( parent )
参数

parent QWindow

PySide2.QtGui.QWindow. setVisibility ( v )
参数

v Visibility

另请参阅

visibility()

PySide2.QtGui.QWindow. setVisible ( visible )
参数

visible bool

另请参阅

isVisible()

PySide2.QtGui.QWindow. setWidth ( arg )
参数

arg int

另请参阅

width()

PySide2.QtGui.QWindow. setWindowState ( state )
参数

state WindowState

set the screen-occupation state of the window

The window state represents whether the window appears in the windowing system as maximized, minimized, fullscreen, or normal.

The enum value WindowActive is not an accepted parameter.

PySide2.QtGui.QWindow. setWindowStates ( states )
参数

states WindowStates

set the screen-occupation state of the window

The window state represents whether the window appears in the windowing system as maximized, minimized and/or fullscreen.

The window can be in a combination of several states. For example, if the window is both minimized and maximized, the window will appear minimized, but clicking on the task bar entry will restore it to the maximized state.

The enum value WindowActive should not be set.

PySide2.QtGui.QWindow. setX ( arg )
参数

arg int

另请参阅

x()

PySide2.QtGui.QWindow. setY ( arg )
参数

arg int

另请参阅

y()

PySide2.QtGui.QWindow. show ( )

展示窗口。

这相当于调用 showFullScreen() , showMaximized() ,或 showNormal() , depending on the platform’s default behavior for the window type and flags.

PySide2.QtGui.QWindow. showEvent ( arg__1 )
参数

arg__1 QShowEvent

Override this to handle show events ( ev ).

The function is called when the window has requested becoming visible.

If the window is successfully shown by the windowing system, this will be followed by a resize and an expose event.

PySide2.QtGui.QWindow. showFullScreen ( )

Shows the window as fullscreen.

相当于调用 setWindowStates ( WindowFullScreen ) and then setVisible (true)。

PySide2.QtGui.QWindow. showMaximized ( )

Shows the window as maximized.

相当于调用 setWindowStates ( WindowMaximized ) and then setVisible (true)。

PySide2.QtGui.QWindow. showMinimized ( )

Shows the window as minimized.

相当于调用 setWindowStates ( WindowMinimized ) and then setVisible (true)。

PySide2.QtGui.QWindow. showNormal ( )

Shows the window as normal, i.e. neither maximized, minimized, nor fullscreen.

相当于调用 setWindowStates ( WindowNoState ) and then setVisible (true)。

PySide2.QtGui.QWindow. sizeIncrement ( )
返回类型

QSize

Returns the size increment of the window.

PySide2.QtGui.QWindow. startSystemMove ( )
返回类型

bool

启动系统特定的移动操作

Calling this will start an interactive move operation on the window by platforms that support it. The actual behavior may vary depending on the platform. Usually, it will make the window follow the mouse cursor until a mouse button is released.

On platforms that support it, this method of moving windows is preferred over setPosition , because it allows a more native look-and-feel of moving windows, e.g. letting the window manager snap this window against other windows, or special tiling or resizing behavior with animations when dragged to the edge of the screen. Furthermore, on some platforms such as Wayland, setPosition is not supported, so this is the only way the application can influence its position.

Returns true if the operation was supported by the system.

PySide2.QtGui.QWindow. startSystemResize ( edges )
参数

edges Edges

返回类型

bool

Start a system-specific resize operation

Calling this will start an interactive resize operation on the window by platforms that support it. The actual behavior may vary depending on the platform. Usually, it will make the window resize so that its edge follows the mouse cursor.

On platforms that support it, this method of resizing windows is preferred over setGeometry , because it allows a more native look-and-feel of resizing windows, e.g. letting the window manager snap this window against other windows, or special resizing behavior with animations when dragged to the edge of the screen.

edges should either be a single edge, or two adjacent edges (a corner). Other values are not allowed.

Returns true if the operation was supported by the system.

PySide2.QtGui.QWindow. tabletEvent ( arg__1 )
参数

arg__1 QTabletEvent

Override this to handle tablet press, move, and release events ( ev ).

Proximity enter and leave events are not sent to windows, they are delivered to the application instance.

PySide2.QtGui.QWindow. title ( )
返回类型

unicode

另请参阅

setTitle()

PySide2.QtGui.QWindow. touchEvent ( arg__1 )
参数

arg__1 QTouchEvent

Override this to handle touch events ( ev ).

PySide2.QtGui.QWindow. transientParent ( )
返回类型

QWindow

PySide2.QtGui.QWindow. transientParentChanged ( transientParent )
参数

transientParent QWindow

PySide2.QtGui.QWindow. type ( )
返回类型

WindowType

Returns the type of the window.

This returns the part of the window flags that represents whether the window is a dialog, tooltip, popup, regular window, etc.

PySide2.QtGui.QWindow. unsetCursor ( )

Restores the default arrow cursor for this window.

PySide2.QtGui.QWindow. visibility ( )
返回类型

Visibility

另请参阅

setVisibility()

PySide2.QtGui.QWindow. visibilityChanged ( visibility )
参数

visibility Visibility

PySide2.QtGui.QWindow. visibleChanged ( arg )
参数

arg bool

PySide2.QtGui.QWindow. wheelEvent ( arg__1 )
参数

arg__1 QWheelEvent

Override this to handle mouse wheel or other wheel events ( ev ).

PySide2.QtGui.QWindow. width ( )
返回类型

int

另请参阅

setWidth()

PySide2.QtGui.QWindow. widthChanged ( arg )
参数

arg int

PySide2.QtGui.QWindow. winId ( )
返回类型

WId

Returns the window’s platform id.

对于此 ID 可能有用的平台,返回值将表示相应屏幕内的唯一窗口。

另请参阅

screen()

PySide2.QtGui.QWindow. windowState ( )
返回类型

WindowState

窗口的屏幕占用状态

PySide2.QtGui.QWindow. windowStateChanged ( windowState )
参数

windowState WindowState

PySide2.QtGui.QWindow. windowStates ( )
返回类型

WindowStates

窗口的屏幕占用状态

The window can be in a combination of several states. For example, if the window is both minimized and maximized, the window will appear minimized, but clicking on the task bar entry will restore it to the maximized state.

另请参阅

setWindowStates()

PySide2.QtGui.QWindow. windowTitleChanged ( title )
参数

title – unicode

PySide2.QtGui.QWindow. x ( )
返回类型

int

另请参阅

setX()

PySide2.QtGui.QWindow. xChanged ( arg )
参数

arg int

PySide2.QtGui.QWindow. y ( )
返回类型

int

另请参阅

setY()

PySide2.QtGui.QWindow. yChanged ( arg )
参数

arg int