Skip to content

PythonQt.QtGui.QWindow

QWindow

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

A window that is supplied a parent becomes a native child window of their parent window.

An application will typically use QWidget or QQuickView for its UI, and not QWindow directly. Still, it is possible to render directly to a QWindow with QBackingStore or QOpenGLContext, when wanting to keep dependencies to a minimum or when wanting to use OpenGL directly. The Raster Window Example and OpenGL Window Example are useful reference examples for how to render to a QWindow using either approach.

Resource Management

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() function.

Content Orientation

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.

Visibility and Windowing System Exposure

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

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

Rendering

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 QSurface::RasterSurface, and QOpenGLContext for rendering with OpenGL to a window with type QSurface::OpenGLSurface.

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

Initial Geometry

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() instead.

Source: https://doc.qt.io/archives/qt-5.15/qwindow.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
AncestorMode attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
AutomaticVisibility attribute Any (shared captured text)
ExcludeTransients attribute Any (shared captured text)
FullScreen attribute Any (shared captured text)
Hidden attribute Any (shared captured text)
IncludeTransients attribute Any (shared captured text)
Maximized attribute Any (shared captured text)
Minimized attribute Any (shared captured text)
Offscreen attribute Any (shared captured text)
OpenGLSurface attribute Any (shared captured text)
RasterGLSurface attribute Any (shared captured text)
RasterSurface attribute Any (shared captured text)
SurfaceClass attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
SurfaceType attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
Visibility attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
Window attribute Any (shared captured text)
Windowed attribute Any (shared captured text)
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
active attribute Any This property holds the active status of the window
activeChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QWindow.activeChanged; argument details are not documented.
alert function (self, msec: int) -> None Causes an alert to be shown for msec miliseconds.
baseSize function (self) -> Any X.baseSize() -> PythonQt.QtCore.QSize
blockSignals function (self, b: Any) -> bool X.blockSignals(b) -> bool (shared captured text)
childEvent function (self, event: Any) -> Any (shared captured text)
children function (self) -> tuple X.children() -> tuple (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
close function (self) -> bool X.close() -> bool
connect function (self, signal: Any, receiver: Any, slot: Any, type: Any) -> bool X.connect(signal, receiver, slot, type) -> bool (shared captured text)
contentOrientation attribute Any This property holds the orientation of the window's contents
contentOrientationChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QWindow.contentOrientationChanged; argument details are not documented.
create function (self) -> None Allocates the platform resources associated with the window.
cursor function (self) -> Any X.cursor() -> PythonQt.QtGui.QCursor
customEvent function (self, event: Any) -> Any (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
deleteLater function (self) -> Any (shared captured text)
destroy function (self) -> None Releases the native platform resources associated with this window.
destroyed function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QWindow.destroyed; argument details are not documented.
devicePixelRatio function (self) -> float X.devicePixelRatio() -> float
disconnect function (self, signal: Any, receiver: Any, slot: Any) -> bool X.disconnect(signal, receiver, slot) -> bool (shared captured text)
dumpObjectInfo function (self) -> Any (shared captured text)
dumpObjectTree function (self) -> Any (shared captured text)
dynamicPropertyNames function (self) -> Any (shared captured text)
event function (self, arg__1: Any) -> bool X.event(arg__1) -> bool
eventFilter function (self, watched: Any, event: Any) -> bool X.eventFilter(watched, event) -> bool (shared captured text)
exposeEvent function (self, arg__1: Any) -> None The expose event (ev) is sent by the window system whenever an area of the window is invalidated, for example due to the exposure in the windowing system changing.
filePath function (self) -> str X.filePath() -> str
findChild function (self, type: Any, name: Any) -> Any X.findChild(type, name) -> PythonQt.private.QObject (shared captured text)
findChildren function (self, type: Any, name: Any) -> tuple X.findChildren(type, name) -> tuple (shared captured text)
flags attribute Any This property holds the window flags of the window
focusInEvent function (self, arg__1: Any) -> None Override this to handle focus in events (ev).
focusObject function (self) -> Any X.focusObject() -> PythonQt.private.QObject
focusObjectChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QWindow.focusObjectChanged; argument details are not documented.
focusOutEvent function (self, arg__1: Any) -> None Override this to handle focus out events (ev).
format function (self) -> Any X.format() -> PythonQt.QtGui.QSurfaceFormat
frameGeometry function (self) -> Any X.frameGeometry() -> PythonQt.QtCore.QRect
frameMargins function (self) -> Any X.frameMargins() -> PythonQt.QtGui.QMargins
framePosition function (self) -> Any X.framePosition() -> PythonQt.QtCore.QPoint
fromWinId function (self, id: int) -> Any X.fromWinId(id) -> PythonQt.QtGui.QWindow
geometry function (self) -> Any X.geometry() -> PythonQt.QtCore.QRect
height attribute int This property holds the height of the window's geometry
heightChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QWindow.heightChanged; argument details are not documented.
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
hide function (self) -> None Hides the window.
hideEvent function (self, arg__1: Any) -> None Override this to handle hide events (ev).
icon function (self) -> Any X.icon() -> PythonQt.QtGui.QIcon
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
installEventFilter function (self, filterObj: Any) -> Any (shared captured text)
isActive function (self) -> bool X.isActive() -> bool
isAncestorOf function (self, child: Any, mode: Any) -> bool X.isAncestorOf(child, mode) -> bool
isExposed function (self) -> bool X.isExposed() -> bool
isModal function (self) -> bool X.isModal() -> bool
isSignalConnected function (self, signal: Any) -> bool X.isSignalConnected(signal) -> bool (shared captured text)
isTopLevel function (self) -> bool X.isTopLevel() -> bool
isVisible function (self) -> bool X.isVisible() -> bool
isWidgetType function (self) -> bool X.isWidgetType() -> bool (shared captured text)
isWindowType function (self) -> bool X.isWindowType() -> bool (shared captured text)
keyPressEvent function (self, arg__1: Any) -> None Override this to handle key press events (ev).
keyReleaseEvent function (self, arg__1: Any) -> None Override this to handle key release events (ev).
killTimer function (self, id: Any) -> Any (shared captured text)
lower function (self) -> None Lower the window in the windowing system.
mapFromGlobal function (self, pos: Any) -> Any X.mapFromGlobal(pos) -> PythonQt.QtCore.QPoint
mapToGlobal function (self, pos: Any) -> Any X.mapToGlobal(pos) -> PythonQt.QtCore.QPoint
mask function (self) -> Any X.mask() -> PythonQt.QtGui.QRegion
maximumHeight attribute int This property holds the maximum height of the window's geometry
maximumHeightChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QWindow.maximumHeightChanged; argument details are not documented.
maximumSize function (self) -> Any X.maximumSize() -> PythonQt.QtCore.QSize
maximumWidth attribute int This property holds the maximum width of the window's geometry
maximumWidthChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QWindow.maximumWidthChanged; argument details are not documented.
metaObject function (self) -> Any X.metaObject() -> PythonQt.QtCore.QMetaObject (shared captured text)
minimumHeight attribute int This property holds the minimum height of the window's geometry
minimumHeightChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QWindow.minimumHeightChanged; argument details are not documented.
minimumSize function (self) -> Any X.minimumSize() -> PythonQt.QtCore.QSize
minimumWidth attribute int This property holds the minimum width of the window's geometry
minimumWidthChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QWindow.minimumWidthChanged; argument details are not documented.
modality attribute Any This property holds the modality of the window
modalityChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QWindow.modalityChanged; argument details are not documented.
mouseDoubleClickEvent function (self, arg__1: Any) -> None Override this to handle mouse double click events (ev).
mouseMoveEvent function (self, arg__1: Any) -> None Override this to handle mouse move events (ev).
mousePressEvent function (self, arg__1: Any) -> None Override this to handle mouse press events (ev).
mouseReleaseEvent function (self, arg__1: Any) -> None Override this to handle mouse release events (ev).
moveEvent function (self, arg__1: Any) -> None Override this to handle window move events (ev).
moveToThread function (self, thread: Any) -> Any (shared captured text)
nativeEvent function (self, eventType: Any, message: int, result: Any) -> bool X.nativeEvent(eventType, message, result) -> bool
objectName attribute Any (shared captured text)
objectNameChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QWindow.objectNameChanged; argument details are not documented.
opacity attribute float This property holds the opacity of the window in the windowing system.
opacityChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QWindow.opacityChanged; argument details are not documented.
parent function (self) -> Any X.parent() -> PythonQt.QtGui.QWindow
position function (self) -> Any X.position() -> PythonQt.QtCore.QPoint
property function (self, name: Any) -> Any X.property(name) -> object (shared captured text)
raise_ function (self) -> Any Native spelling: raise; access it through getattr on the native object.
removeEventFilter function (self, obj: Any) -> Any (shared captured text)
reportContentOrientationChange function (self, orientation: Any) -> None
requestActivate function (self) -> None Requests the window to be activated, i.e. receive keyboard focus.
requestUpdate function (self) -> None Schedules a [QEvent::UpdateRequest](https://doc.qt.io/archives/qt-5.15/qevent.html#Type-enum) event to be delivered to this window.
requestedFormat function (self) -> Any X.requestedFormat() -> PythonQt.QtGui.QSurfaceFormat
resize function (self, w: Any, h: Any) -> None X.resize(w, h)
resizeEvent function (self, arg__1: Any) -> None Override this to handle resize events (ev).
screen function (self) -> Any X.screen() -> PythonQt.QtGui.QScreen
screenChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QWindow.screenChanged; argument details are not documented.
sender function (self) -> Any X.sender() -> PythonQt.private.QObject (shared captured text)
senderSignalIndex function (self) -> int X.senderSignalIndex() -> int (shared captured text)
setBaseSize function (self, size: Any) -> None Sets the base size of the window.
setCursor function (self, arg__1: Any) -> None Set the cursor shape for this window
setFilePath function (self, filePath: str) -> None Set the file name this window is representing.
setFlags function (self, arg0: flags) -> None
setFormat function (self, format: Any) -> None Sets the window's surface format.
setFramePosition function (self, point: Any) -> None Sets the upper left position of the window (point) including its window frame.
setGeometry function (self, posx: Any, posy: Any, w: Any, h: Any) -> None X.setGeometry(posx, posy, w, h)
setHeight function (self, arg: int) -> None
setIcon function (self, icon: Any) -> None Sets the window's icon in the windowing system
setKeyboardGrabEnabled function (self, grab: bool) -> bool X.setKeyboardGrabEnabled(grab) -> bool
setMask function (self, region: Any) -> None Sets the mask of the window.
setMaximumHeight function (self, h: int) -> None
setMaximumSize function (self, size: Any) -> None Sets the maximum size of the window.
setMaximumWidth function (self, w: int) -> None
setMinimumHeight function (self, h: int) -> None
setMinimumSize function (self, size: Any) -> None Sets the minimum size of the window.
setMinimumWidth function (self, w: int) -> None
setModality function (self, modality: Any) -> None
setMouseGrabEnabled function (self, grab: bool) -> bool X.setMouseGrabEnabled(grab) -> bool
setObjectName function (self, name: Any) -> Any (shared captured text)
setOpacity function (self, level: float) -> None
setParent function (self, parent: Any) -> None Sets the parent Window.
setPosition function (self, posx: Any, posy: Any) -> None X.setPosition(posx, posy)
setProperty function (self, name: Any, value: Any) -> bool X.setProperty(name, value) -> bool (shared captured text)
setScreen function (self, screen: Any) -> None Sets the screen on which the window should be shown.
setSizeIncrement function (self, size: Any) -> None Sets the size increment (size) of the window.
setSurfaceType function (self, surfaceType: Any) -> None Sets the surfaceType of the window.
setTitle function (self, a: Any) -> None
setTransientParent function (self, parent: Any) -> None
setVisibility function (self, v: Any) -> None
setVisible function (self, visible: bool) -> None
setWidth function (self, arg: int) -> None
setWindowState function (self, state: Any) -> None Set the screen-occupation state of the window
setX function (self, arg: int) -> None
setY function (self, arg: int) -> None
show function (self) -> None Shows the window.
showEvent function (self, arg__1: Any) -> None Override this to handle show events (ev).
showFullScreen function (self) -> None Shows the window as fullscreen.
showMaximized function (self) -> None Shows the window as maximized.
showMinimized function (self) -> None Shows the window as minimized.
showNormal function (self) -> None Shows the window as normal, i.e. neither maximized, minimized, nor fullscreen.
signalsBlocked function (self) -> bool X.signalsBlocked() -> bool (shared captured text)
size function (self) -> Any X.size() -> PythonQt.QtCore.QSize
sizeIncrement function (self) -> Any X.sizeIncrement() -> PythonQt.QtCore.QSize
startSystemMove function (self) -> bool X.startSystemMove() -> bool
startSystemResize function (self, edges: Any) -> bool X.startSystemResize(edges) -> bool
startTimer function (self, interval: Any, timerType: Any) -> int X.startTimer(interval, timerType) -> int (shared captured text)
supportsOpenGL function (self) -> bool X.supportsOpenGL() -> bool (shared captured text)
surfaceClass function (self) -> Any (shared captured text)
surfaceHandle function (self) -> int
surfaceType function (self) -> Any Reimplements: [QSurface::surfaceType](https://doc.qt.io/archives/qt-5.15/qsurface.html#surfaceType)() const.
tabletEvent function (self, arg__1: Any) -> None Override this to handle tablet press, move, and release events (ev).
thread function (self) -> Any (shared captured text)
timerEvent function (self, event: Any) -> Any (shared captured text)
title attribute str This property holds the window's title in the windowing system
touchEvent function (self, arg__1: Any) -> None Override this to handle touch events (ev).
tr function (self, text: Any, ambig: Any, n: Any) -> str X.tr(text, ambig, n) -> str (shared captured text)
transientParent attribute QWindow (shared captured text)
transientParentChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QWindow.transientParentChanged; argument details are not documented.
type function (self) -> Any Returns the type of the window.
unsetCursor function (self) -> None Restores the default arrow cursor for this window.
visibility attribute Any This property holds the screen-occupation state of the window
visibilityChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QWindow.visibilityChanged; argument details are not documented.
visible attribute Any This property holds whether the window is visible or not
visibleChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QWindow.visibleChanged; argument details are not documented.
wheelEvent function (self, arg__1: Any) -> None Override this to handle mouse wheel or other wheel events (ev).
width attribute int This property holds the width of the window's geometry
widthChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QWindow.widthChanged; argument details are not documented.
winId function (self) -> int X.winId() -> int
windowState function (self) -> Any The screen-occupation state of the window
windowStateChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QWindow.windowStateChanged; argument details are not documented.
windowTitleChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QWindow.windowTitleChanged; argument details are not documented.
x attribute int This property holds the x position of the window's geometry
xChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QWindow.xChanged; argument details are not documented.
y attribute int This property holds the y position of the window's geometry
yChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QWindow.yChanged; argument details are not documented.