Skip to content

PythonQt.Qt.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 (shared captured text)
activeChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QWindow.activeChanged; argument details are not documented.
alert function (self, msec: int) -> None Causes an alert to be shown for msec miliseconds. (shared captured text)
baseSize function (self) -> Any X.baseSize() -> PythonQt.QtCore.QSize (shared captured text)
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 (shared captured text)
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 (shared captured text)
contentOrientationChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QWindow.contentOrientationChanged; argument details are not documented.
create function (self) -> None Allocates the platform resources associated with the window. (shared captured text)
cursor function (self) -> Any X.cursor() -> PythonQt.QtGui.QCursor (shared captured text)
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. (shared captured text)
destroyed function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QWindow.destroyed; argument details are not documented.
devicePixelRatio function (self) -> float X.devicePixelRatio() -> float (shared captured text)
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 (shared captured text)
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. (shared captured text)
filePath function (self) -> str X.filePath() -> str (shared captured text)
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 (shared captured text)
focusInEvent function (self, arg__1: Any) -> None Override this to handle focus in events (ev). (shared captured text)
focusObject function (self) -> Any X.focusObject() -> PythonQt.private.QObject (shared captured text)
focusObjectChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QWindow.focusObjectChanged; argument details are not documented.
focusOutEvent function (self, arg__1: Any) -> None Override this to handle focus out events (ev). (shared captured text)
format function (self) -> Any X.format() -> PythonQt.QtGui.QSurfaceFormat (shared captured text)
frameGeometry function (self) -> Any X.frameGeometry() -> PythonQt.QtCore.QRect (shared captured text)
frameMargins function (self) -> Any X.frameMargins() -> PythonQt.QtGui.QMargins (shared captured text)
framePosition function (self) -> Any X.framePosition() -> PythonQt.QtCore.QPoint (shared captured text)
fromWinId function (self, id: int) -> Any X.fromWinId(id) -> PythonQt.QtGui.QWindow (shared captured text)
geometry function (self) -> Any X.geometry() -> PythonQt.QtCore.QRect (shared captured text)
height attribute int This property holds the height of the window's geometry (shared captured text)
heightChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.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. (shared captured text)
hideEvent function (self, arg__1: Any) -> None Override this to handle hide events (ev). (shared captured text)
icon function (self) -> Any X.icon() -> PythonQt.QtGui.QIcon (shared captured text)
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 (shared captured text)
isAncestorOf function (self, child: Any, mode: Any) -> bool X.isAncestorOf(child, mode) -> bool (shared captured text)
isExposed function (self) -> bool X.isExposed() -> bool (shared captured text)
isModal function (self) -> bool X.isModal() -> bool (shared captured text)
isSignalConnected function (self, signal: Any) -> bool X.isSignalConnected(signal) -> bool (shared captured text)
isTopLevel function (self) -> bool X.isTopLevel() -> bool (shared captured text)
isVisible function (self) -> bool X.isVisible() -> bool (shared captured text)
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). (shared captured text)
keyReleaseEvent function (self, arg__1: Any) -> None Override this to handle key release events (ev). (shared captured text)
killTimer function (self, id: Any) -> Any (shared captured text)
lower function (self) -> None Lower the window in the windowing system. (shared captured text)
mapFromGlobal function (self, pos: Any) -> Any X.mapFromGlobal(pos) -> PythonQt.QtCore.QPoint (shared captured text)
mapToGlobal function (self, pos: Any) -> Any X.mapToGlobal(pos) -> PythonQt.QtCore.QPoint (shared captured text)
mask function (self) -> Any X.mask() -> PythonQt.QtGui.QRegion (shared captured text)
maximumHeight attribute int This property holds the maximum height of the window's geometry (shared captured text)
maximumHeightChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QWindow.maximumHeightChanged; argument details are not documented.
maximumSize function (self) -> Any X.maximumSize() -> PythonQt.QtCore.QSize (shared captured text)
maximumWidth attribute int This property holds the maximum width of the window's geometry (shared captured text)
maximumWidthChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.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 (shared captured text)
minimumHeightChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QWindow.minimumHeightChanged; argument details are not documented.
minimumSize function (self) -> Any X.minimumSize() -> PythonQt.QtCore.QSize (shared captured text)
minimumWidth attribute int This property holds the minimum width of the window's geometry (shared captured text)
minimumWidthChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QWindow.minimumWidthChanged; argument details are not documented.
modality attribute Any This property holds the modality of the window (shared captured text)
modalityChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QWindow.modalityChanged; argument details are not documented.
mouseDoubleClickEvent function (self, arg__1: Any) -> None Override this to handle mouse double click events (ev). (shared captured text)
mouseMoveEvent function (self, arg__1: Any) -> None Override this to handle mouse move events (ev). (shared captured text)
mousePressEvent function (self, arg__1: Any) -> None Override this to handle mouse press events (ev). (shared captured text)
mouseReleaseEvent function (self, arg__1: Any) -> None Override this to handle mouse release events (ev). (shared captured text)
moveEvent function (self, arg__1: Any) -> None Override this to handle window move events (ev). (shared captured text)
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 (shared captured text)
objectName attribute Any (shared captured text)
objectNameChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QWindow.objectNameChanged; argument details are not documented.
opacity attribute float This property holds the opacity of the window in the windowing system. (shared captured text)
opacityChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QWindow.opacityChanged; argument details are not documented.
parent function (self) -> Any X.parent() -> PythonQt.QtGui.QWindow (shared captured text)
position function (self) -> Any X.position() -> PythonQt.QtCore.QPoint (shared captured text)
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. (shared captured text)
removeEventFilter function (self, obj: Any) -> Any (shared captured text)
reportContentOrientationChange function (self, orientation: Any) -> None (shared captured text)
requestActivate function (self) -> None Requests the window to be activated, i.e. receive keyboard focus. (shared captured text)
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. (shared captured text)
requestedFormat function (self) -> Any X.requestedFormat() -> PythonQt.QtGui.QSurfaceFormat (shared captured text)
resize function (self, w: Any, h: Any) -> None X.resize(w, h) (shared captured text)
resizeEvent function (self, arg__1: Any) -> None Override this to handle resize events (ev). (shared captured text)
screen function (self) -> Any X.screen() -> PythonQt.QtGui.QScreen (shared captured text)
screenChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.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. (shared captured text)
setCursor function (self, arg__1: Any) -> None Set the cursor shape for this window (shared captured text)
setFilePath function (self, filePath: str) -> None Set the file name this window is representing. (shared captured text)
setFlags function (self, arg0: flags) -> None (shared captured text)
setFormat function (self, format: Any) -> None Sets the window's surface format. (shared captured text)
setFramePosition function (self, point: Any) -> None Sets the upper left position of the window (point) including its window frame. (shared captured text)
setGeometry function (self, posx: Any, posy: Any, w: Any, h: Any) -> None X.setGeometry(posx, posy, w, h) (shared captured text)
setHeight function (self, arg: int) -> None (shared captured text)
setIcon function (self, icon: Any) -> None Sets the window's icon in the windowing system (shared captured text)
setKeyboardGrabEnabled function (self, grab: bool) -> bool X.setKeyboardGrabEnabled(grab) -> bool (shared captured text)
setMask function (self, region: Any) -> None Sets the mask of the window. (shared captured text)
setMaximumHeight function (self, h: int) -> None (shared captured text)
setMaximumSize function (self, size: Any) -> None Sets the maximum size of the window. (shared captured text)
setMaximumWidth function (self, w: int) -> None (shared captured text)
setMinimumHeight function (self, h: int) -> None (shared captured text)
setMinimumSize function (self, size: Any) -> None Sets the minimum size of the window. (shared captured text)
setMinimumWidth function (self, w: int) -> None (shared captured text)
setModality function (self, modality: Any) -> None (shared captured text)
setMouseGrabEnabled function (self, grab: bool) -> bool X.setMouseGrabEnabled(grab) -> bool (shared captured text)
setObjectName function (self, name: Any) -> Any (shared captured text)
setOpacity function (self, level: float) -> None (shared captured text)
setParent function (self, parent: Any) -> None Sets the parent Window. (shared captured text)
setPosition function (self, posx: Any, posy: Any) -> None X.setPosition(posx, posy) (shared captured text)
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. (shared captured text)
setSizeIncrement function (self, size: Any) -> None Sets the size increment (size) of the window. (shared captured text)
setSurfaceType function (self, surfaceType: Any) -> None Sets the surfaceType of the window. (shared captured text)
setTitle function (self, a: Any) -> None (shared captured text)
setTransientParent function (self, parent: Any) -> None (shared captured text)
setVisibility function (self, v: Any) -> None (shared captured text)
setVisible function (self, visible: bool) -> None (shared captured text)
setWidth function (self, arg: int) -> None (shared captured text)
setWindowState function (self, state: Any) -> None Set the screen-occupation state of the window (shared captured text)
setX function (self, arg: int) -> None (shared captured text)
setY function (self, arg: int) -> None (shared captured text)
show function (self) -> None Shows the window. (shared captured text)
showEvent function (self, arg__1: Any) -> None Override this to handle show events (ev). (shared captured text)
showFullScreen function (self) -> None Shows the window as fullscreen. (shared captured text)
showMaximized function (self) -> None Shows the window as maximized. (shared captured text)
showMinimized function (self) -> None Shows the window as minimized. (shared captured text)
showNormal function (self) -> None Shows the window as normal, i.e. neither maximized, minimized, nor fullscreen. (shared captured text)
signalsBlocked function (self) -> bool X.signalsBlocked() -> bool (shared captured text)
size function (self) -> Any X.size() -> PythonQt.QtCore.QSize (shared captured text)
sizeIncrement function (self) -> Any X.sizeIncrement() -> PythonQt.QtCore.QSize (shared captured text)
startSystemMove function (self) -> bool X.startSystemMove() -> bool (shared captured text)
startSystemResize function (self, edges: Any) -> bool X.startSystemResize(edges) -> bool (shared captured text)
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 (shared captured text)
surfaceType function (self) -> Any Reimplements: [QSurface::surfaceType](https://doc.qt.io/archives/qt-5.15/qsurface.html#surfaceType)() const. (shared captured text)
tabletEvent function (self, arg__1: Any) -> None Override this to handle tablet press, move, and release events (ev). (shared captured text)
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 (shared captured text)
touchEvent function (self, arg__1: Any) -> None Override this to handle touch events (ev). (shared captured text)
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.Qt.QWindow.transientParentChanged; argument details are not documented.
type function (self) -> Any Returns the type of the window. (shared captured text)
unsetCursor function (self) -> None Restores the default arrow cursor for this window. (shared captured text)
visibility attribute Any This property holds the screen-occupation state of the window (shared captured text)
visibilityChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QWindow.visibilityChanged; argument details are not documented.
visible attribute Any This property holds whether the window is visible or not (shared captured text)
visibleChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.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). (shared captured text)
width attribute int This property holds the width of the window's geometry (shared captured text)
widthChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QWindow.widthChanged; argument details are not documented.
winId function (self) -> int X.winId() -> int (shared captured text)
windowState function (self) -> Any The screen-occupation state of the window (shared captured text)
windowStateChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QWindow.windowStateChanged; argument details are not documented.
windowTitleChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QWindow.windowTitleChanged; argument details are not documented.
x attribute int This property holds the x position of the window's geometry (shared captured text)
xChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QWindow.xChanged; argument details are not documented.
y attribute int This property holds the y position of the window's geometry (shared captured text)
yChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QWindow.yChanged; argument details are not documented.