CopperSpice API  1.9.1
QWindow Class Reference

Represents a window in the underlying windowing system. More...

Inheritance diagram for QWindow:
QObject QSurface QPaintDeviceWindow QVulkanWindow QOpenGLWindow QRasterWindow

Public Types

enum  AncestorMode
 
enum  Visibility
 
- Public Types inherited from QSurface
enum  SurfaceClass
 
enum  SurfaceType
 

Public Signals

void contentOrientationChanged (Qt::ScreenOrientation orientation)
 
void focusObjectChanged (QObject *object)
 
void modalityChanged (Qt::WindowModality modality)
 
void screenChanged (QScreen *screen)
 
void windowStateChanged (Qt::WindowState windowState)
 
- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 

Public Slots

void alert (int msec)
 
bool close ()
 
void hide ()
 
void lower ()
 
void raise ()
 
void requestActivate ()
 
void requestUpdate ()
 
void setMaximumWidth (int width)
 
void setVisible (bool visible)
 
void show ()
 
void showFullScreen ()
 
void showMaximized ()
 
void showMinimized ()
 
void showNormal ()
 
- Public Slots inherited from QObject
void deleteLater ()
 

Public Methods

 QWindow (QScreen *screen=nullptr)
 
 QWindow (QWindow *parent)
 
virtual ~QWindow ()
 
QSize baseSize () const
 
Qt::ScreenOrientation contentOrientation () const
 
void create ()
 
QCursor cursor () const
 
void destroy ()
 
qreal devicePixelRatio () const
 
QString filePath () const
 
Qt::WindowFlags flags () const
 
virtual QObjectfocusObject () const
 
QSurfaceFormat format () const override
 
QRect frameGeometry () const
 
QMargins frameMargins () const
 
QPoint framePosition () const
 
QRect geometry () const
 
QIcon icon () const
 
bool isActive () const
 
bool isAncestorOf (const QWindow *child, AncestorMode mode=IncludeTransients) const
 
bool isExposed () const
 
bool isModal () const
 
bool isTopLevel () const
 
bool isVisible () const
 
QPoint mapFromGlobal (const QPoint &pos) const
 
QPoint mapToGlobal (const QPoint &pos) const
 
QRegion mask () const
 
QSize maximumSize () const
 
QSize minimumSize () const
 
Qt::WindowModality modality () const
 
QWindow * parent () const
 
QPoint position () const
 
void reportContentOrientationChange (Qt::ScreenOrientation orientation)
 
QSurfaceFormat requestedFormat () const
 
void resize (const QSize &newSize)
 
void resize (int w, int h)
 
QScreenscreen () const
 
void setBaseSize (const QSize &size)
 
void setCursor (const QCursor &cursor)
 
void setFilePath (const QString &filePath)
 
void setFlags (Qt::WindowFlags flags)
 
void setFormat (const QSurfaceFormat &format)
 
void setFramePosition (const QPoint &point)
 
void setGeometry (const QRect &rect)
 
void setGeometry (int posx, int posy, int w, int h)
 
void setIcon (const QIcon &icon)
 
bool setKeyboardGrabEnabled (bool grab)
 
void setMask (const QRegion &region)
 
void setMaximumSize (const QSize &size)
 
void setMinimumSize (const QSize &size)
 
void setModality (Qt::WindowModality modality)
 
bool setMouseGrabEnabled (bool grab)
 
void setParent (QWindow *parent)
 
void setPosition (const QPoint &pt)
 
void setPosition (int posx, int posy)
 
void setScreen (QScreen *screen)
 
void setSizeIncrement (const QSize &size)
 
void setSurfaceType (SurfaceType surfaceType)
 
void setTransientParent (QWindow *parent)
 
void setVulkanInstance (QVulkanInstance *instance)
 
void setWindowState (Qt::WindowState state)
 
QSize size () const override
 
QSize sizeIncrement () const
 
SurfaceType surfaceType () const override
 
QWindow * transientParent () const
 
Qt::WindowType type () const
 
void unsetCursor ()
 
QVulkanInstancevulkanInstance () const
 
Qt::WindowState windowState () const
 
WId winId () const
 
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 
 ~QObject ()
 
bool blockSignals (bool block)
 
const QList< QObject * > & children () const
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QStringdynamicPropertyNames () const
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
template<typename T >
findChild (const QString &childName=QString ()) const
 
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<class T >
QList< T > findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
bool inherits (const QString &className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
QObject * parent () const
 
template<class T = QVariant>
property (const QString &name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const QString &name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
QThreadthread () const
 
- Public Methods inherited from QSurface
virtual ~QSurface ()
 
bool supportsOpenGL () const
 
SurfaceClass surfaceClass () const
 

Static Public Methods

static QWindow * fromWinId (WId id)
 
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
 
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
 
static QMetaObjectstaticMetaObject ()
 
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 

Protected Methods

bool event (QEvent *event) override
 
virtual void exposeEvent (QExposeEvent *event)
 
virtual void focusInEvent (QFocusEvent *event)
 
virtual void focusOutEvent (QFocusEvent *event)
 
virtual void hideEvent (QHideEvent *event)
 
virtual void keyPressEvent (QKeyEvent *event)
 
virtual void keyReleaseEvent (QKeyEvent *event)
 
virtual void mouseDoubleClickEvent (QMouseEvent *event)
 
virtual void mouseMoveEvent (QMouseEvent *event)
 
virtual void mousePressEvent (QMouseEvent *event)
 
virtual void mouseReleaseEvent (QMouseEvent *event)
 
virtual void moveEvent (QMoveEvent *event)
 
virtual bool nativeEvent (const QByteArray &eventType, void *message, long *result)
 
virtual void resizeEvent (QResizeEvent *event)
 
virtual void showEvent (QShowEvent *event)
 
virtual void tabletEvent (QTabletEvent *event)
 
virtual void wheelEvent (QWheelEvent *event)
 
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signalMethod) const
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
 
bool isSignalConnected (const QMetaMethod &signalMethod) const
 
int receivers (const QString &signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Protected Methods inherited from QSurface
 QSurface (SurfaceClass type)
 

Properties

 active
 
 contentOrientation
 
 flags
 
 height
 
 maximumHeight
 
 maximumWidth
 
 minimumHeight
 
 minimumWidth
 
 modality
 
 opacity
 
 title
 
 visibility
 
 visible
 
 width
 
 x
 
 y
 
- Properties inherited from QObject
 objectName
 

Friends

class QApplication
 

Additional Inherited Members

Detailed Description

The QWindow class represents a window in the underlying windowing system. A window which has a parent becomes a native child window of its parent.

An application will typically use QWidget 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 is 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 the windows exposure in the windowing system changes. 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 windowState().

Rendering

There are two 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.

On X11, if 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.

Member Enumeration Documentation

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

Constant Value Description
QWindow::ExcludeTransients 0 Transient parents are not considered ancestors
QWindow::IncludeTransients 1 Transient parents are considered ancestors

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

Constant Value Description
QWindow::Hidden 0 The window is not visible in any way, however it may remember a latent visibility which can be restored by setting AutomaticVisibility.
QWindow::AutomaticVisibility 1 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::Windowed 2 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 3 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./td>
QWindow::Maximized 4 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 5 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

Constructor & Destructor Documentation

QWindow::QWindow ( QScreen screen = nullptr)
explicit

Creates a window as a top level on the screen. The window is not shown until setVisible(true), show(), or similar is called.

See also
setScreen()
QWindow::QWindow ( QWindow *  parent)
explicit

Creates a window as a child of the given parent window. The window will be embedded inside the parent window, its coordinates relative to the parent.

The screen is inherited from the parent.

See also
setParent()
QWindow::~QWindow ( )
virtual

Destroys the window.

Method Documentation

void QWindow::alert ( int  msec)
slot

Causes an alert to be shown for msec milliseconds. If msec is 0 (the default) then the alert is shown indefinitely until the window becomes active again. This method 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.

QSize QWindow::baseSize ( ) const

Returns the base size of the window.

See also
setBaseSize()
bool QWindow::close ( )
slot

This method 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).

See also
destroy(), QApplication::quitOnLastWindowClosed()
Qt::ScreenOrientation QWindow::contentOrientation ( ) const

Returns the value of the QWindow::contentOrientation property.

void QWindow::contentOrientationChanged ( Qt::ScreenOrientation  orientation)
signal

This signal is emitted when the value of the QWindow::contentOrientation property changes. The specified orientation represents the updated value.

void 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() is called.

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

Call destroy() to free the platform resources if necessary.

See also
destroy()
QCursor QWindow::cursor ( ) const

Returns the cursor shape for this window.

See also
setCursor(), unsetCursor()
void QWindow::destroy ( )

Releases the native platform resources associated with this window.

See also
create()
qreal QWindow::devicePixelRatio ( ) const

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.

Note
For windows not backed by a platform window, meaning that create() was not called, the function will fall back to QApplication::devicePixelRatio() which in turn returns the highest screen device pixel ratio found on the system.
See also
QScreen::devicePixelRatio(), QApplication::devicePixelRatio()
bool QWindow::event ( QEvent event)
overrideprotected

Override this to handle any event (event) sent to the window. Return true if the event was recognized and processed. Remember to call the base class version if you wish for mouse events, key events, resize events, etc to be dispatched as usual.

void QWindow::exposeEvent ( QExposeEvent event)
protectedvirtual

The expose event (event) is sent by the window system whenever the window's exposure on screen changes.

The application can start rendering into the window with QBackingStore and QOpenGLContext as soon as it gets an exposeEvent() such that isExposed() is true.

If the window is moved off screen, is made totally obscured by another window, iconified or similar, this function might be called and the value of isExposed() might change to false. When this happens, an application should stop its rendering as it is no longer visible to the user.

A resize event will always be sent before the expose event the first time a window is shown.

See also
isExposed()

Reimplemented in QVulkanWindow::exposeEvent()

QString QWindow::filePath ( ) const

Returns the file name this window is representing.

See also
setFilePath()
Qt::WindowFlags QWindow::flags ( ) const

Returns the value of the property.

void QWindow::focusInEvent ( QFocusEvent event)
protectedvirtual

Override this to handle focus in events (event). Focus in events are sent when the window receives keyboard focus.

See also
focusOutEvent()
QObject * QWindow::focusObject ( ) const
virtual

Returns the QObject which will be the final receiver of events tied focus, such as key events.

void QWindow::focusObjectChanged ( QObject object)
signal

This signal is emitted when the final receiver of events tied to focus is changed to object.

See also
focusObject()
void QWindow::focusOutEvent ( QFocusEvent event)
protectedvirtual

Override this to handle focus out events (event). Focus out events are sent when the window loses keyboard focus.

See also
focusInEvent()
QSurfaceFormat QWindow::format ( ) const
overridevirtual

Returns the actual format of this window.

After the window has been created, this function will return the actual surface format of the window. It might differ from the requested format if the requested format could not be fulfilled by the platform. It might also be a superset, for example certain buffer sizes may be larger than requested.

Note
Depending on the platform, certain values in this surface format may still contain the requested values, that is, the values that have been passed to setFormat(). Typical examples are the OpenGL version, profile and options. These may not get updated during create() since these are context specific and a single window may be used together with multiple contexts over its lifetime. Use the QOpenGLContext format() instead to query such values.
See also
create(), requestedFormat(), QOpenGLContext::format()

Implements QSurface::format()

QRect QWindow::frameGeometry ( ) const

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

See also
geometry(), frameMargins()
QMargins QWindow::frameMargins ( ) const

Returns the window frame margins surrounding the window.

See also
geometry(), frameGeometry()
QPoint QWindow::framePosition ( ) const

Returns the top left position of the window, including its window frame. This returns the same value as frameGeometry().topLeft().

See also
geometry(), frameGeometry()
QWindow * QWindow::fromWinId ( WId  id)
static

Creates a local representation of a window created by another process or by using native libraries other than CopperSpice.

Given the handle id to a native window, this method creates a QWindow object which can be used to represent the window when invoking methods like setParent() and setTransientParent(). This can be used, on platforms which support it, to embed a QWindow inside a native window, or to embed a native window inside a QWindow.

If foreign windows are not supported, this function returns a nullptr.

Note
The resulting QWindow should not be used to manipulate the underlying native window (besides re-parenting), or to observe state changes of the native window. Any support for these kind of operations is incidental, highly platform dependent and untested.
See also
setParent(), setTransientParent()
QRect QWindow::geometry ( ) const

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

See also
frameMargins(), frameGeometry()
void QWindow::hide ( )
slot

Hides the window. Equivalent to calling setVisible(false).

See also
show(), setVisible()
void QWindow::hideEvent ( QHideEvent event)
protectedvirtual

Override this to handle hide events (event). The method is called when the window has requested being hidden in the windowing system.

QIcon QWindow::icon ( ) const

Sets the window's icon in the windowing system

See also
setIcon()
bool QWindow::isActive ( ) const

Returns 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 QApplication::focusWindow().

bool QWindow::isAncestorOf ( const QWindow *  child,
AncestorMode  mode = IncludeTransients 
) const

Returns true if the window is an ancestor of the given child. If mode is IncludeTransients, then transient parents are also considered ancestors.

bool QWindow::isExposed ( ) const

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.

See also
exposeEvent()
bool QWindow::isModal ( ) const

Returns whether the window is modal. A modal window prevents other windows from getting any input.

See also
QWindow::modality
bool QWindow::isTopLevel ( ) const

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

bool QWindow::isVisible ( ) const

Returns the value of the property.

void QWindow::keyPressEvent ( QKeyEvent event)
protectedvirtual

Override this to handle key press events (event).

See also
keyReleaseEvent()
void QWindow::keyReleaseEvent ( QKeyEvent event)
protectedvirtual

Override this to handle key release events (event).

See also
keyPressEvent()
void QWindow::lower ( )
slot

Lower the window in the windowing system. Requests that the window be lowered to appear below other windows.

QPoint QWindow::mapFromGlobal ( const QPoint pos) const

Translates the global screen coordinate pos to window coordinates.

See also
mapToGlobal()
QPoint QWindow::mapToGlobal ( const QPoint pos) const

Translates the window coordinate pos to global screen coordinates. For example, mapToGlobal(QPoint(0,0) would give the global coordinates of the top-left pixel of the window.

See also
mapFromGlobal()
QRegion QWindow::mask ( ) const

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.

QSize QWindow::maximumSize ( ) const

Returns the maximum size of the window.

See also
setMaximumSize()
QSize QWindow::minimumSize ( ) const

Returns the minimum size of the window.

See also
setMinimumSize()
Qt::WindowModality QWindow::modality ( ) const

Returns the value of the QWindow::modality property.

void QWindow::modalityChanged ( Qt::WindowModality  modality)
signal

This signal is emitted when the QWindow::modality property changes to modality.

void QWindow::mouseDoubleClickEvent ( QMouseEvent event)
protectedvirtual

Override this method to handle a mouse double click event.

See also
mousePressEvent(), QStyleHints::mouseDoubleClickInterval()
void QWindow::mouseMoveEvent ( QMouseEvent event)
protectedvirtual

Override this to handle mouse move events (event).

void QWindow::mousePressEvent ( QMouseEvent event)
protectedvirtual

Override this to handle mouse press events (event).

See also
mouseReleaseEvent()
void QWindow::mouseReleaseEvent ( QMouseEvent event)
protectedvirtual

Override this to handle mouse release events (event).

See also
mousePressEvent()
void QWindow::moveEvent ( QMoveEvent event)
protectedvirtual

Override this to handle window move events (event).

bool QWindow::nativeEvent ( const QByteArray eventType,
void *  message,
long *  result 
)
protectedvirtual

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.

QWindow * QWindow::parent ( ) const

Returns the parent window, if any. A window without a parent is known as a top level window.

QPoint QWindow::position ( ) const
inline

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

See also
setPosition()
void QWindow::raise ( )
slot

Raise the window in the windowing system. Requests that the window be raised to appear above other windows.

void QWindow::reportContentOrientationChange ( Qt::ScreenOrientation  orientation)

Sets the value of the QWindow::contentOrientation property to orientation.

void QWindow::requestActivate ( )
slot

Requests the window to be activated, i.e. receive keyboard focus.

See also
isActive(), QApplication::focusWindow()
QSurfaceFormat QWindow::requestedFormat ( ) const

Returns the requested surface format of this window.

If the requested format was not supported by the platform implementation it will differ from the actual window format. This is the value set with setFormat().

See also
setFormat(), format()
void QWindow::requestUpdate ( )
slot

Schedules a QEvent::UpdateRequest event to be delivered to this window. The event is delivered in sync with the display vsync on platforms where this is possible. When driving animations, this function should be called once after drawing has completed.

Calling this method multiple times will result in a single event being delivered to the window.

Subclasses of 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 QEvent::Timer events. Filtering them away would therefore break the delivery of the update events.

void QWindow::resize ( const QSize newSize)

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

See also
size(), geometry()
void QWindow::resize ( int  w,
int  h 
)

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

See also
size(), geometry()
void QWindow::resizeEvent ( QResizeEvent event)
protectedvirtual

Override this to handle resize events (event).

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.

QScreen * QWindow::screen ( ) const

Returns the screen on which the window is shown, or null if there is none.

For child windows, this returns the screen of the corresponding top level window.

See also
setScreen(), QScreen::virtualSiblings()
void QWindow::screenChanged ( QScreen screen)
signal

This signal is emitted when a window's screen changes, either by being set explicitly with setScreen(), or automatically when the window's screen is removed.

void QWindow::setBaseSize ( const QSize size)

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

See also
setMinimumSize(), setMaximumSize(), setSizeIncrement(), baseSize()
void QWindow::setCursor ( const QCursor cursor)

Sets the cursor shape for this window to the given cursor. The mouse cursor will be displayed when the mouse is over this window, unless an override cursor is set. By default, the cursor has the Qt::ArrowCursor shape. Refer to Qt::CursorShape for a range of useful shapes.

Some 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 QApplication::setOverrideCursor().

See also
QApplication::setOverrideCursor()
void QWindow::setFilePath ( const QString filePath)

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.

void QWindow::setFlags ( Qt::WindowFlags  flags)

Sets the value of the property to flags.

void QWindow::setFormat ( const QSurfaceFormat format)

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

window.setFormat(format);

The surface format will be resolved in the create() method. 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 QSurfaceFormat::defaultFormat() will be used. This means that when having multiple windows, individual calls to this function can be replaced by one single call to QSurfaceFormat::setDefaultFormat() before creating the first window.

See also
create(), destroy(), QSurfaceFormat::setDefaultFormat()
void QWindow::setFramePosition ( const QPoint point)

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

See also
setGeometry(), frameGeometry()
void QWindow::setGeometry ( const QRect rect)

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

See also
geometry()
void QWindow::setGeometry ( int  posx,
int  posy,
int  w,
int  h 
)

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

See also
geometry()
void QWindow::setIcon ( const QIcon icon)

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.

bool QWindow::setKeyboardGrabEnabled ( bool  grab)

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

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

See also
setMouseGrabEnabled()
void QWindow::setMask ( const QRegion region)

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.

Setting the mask before the window has been created has no effect.

void QWindow::setMaximumSize ( const QSize size)

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

See also
setMinimumSize(), maximumSize()
void QWindow::setMaximumWidth ( int  width)
slot

Sets the maximum width of the window. This is a hint to the window manager to prevent resizing below the specified width.

See also
setMinimumSize(), maximumSize()
void QWindow::setMinimumSize ( const QSize size)

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

See also
setMaximumSize(), minimumSize()
void QWindow::setModality ( Qt::WindowModality  modality)

Sets the value of the QWindow::modality property to modality.

bool QWindow::setMouseGrabEnabled ( bool  grab)

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

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

See also
setKeyboardGrabEnabled()
void QWindow::setParent ( QWindow *  parent)

Sets the parent Window. This will lead to the windowing system managing the clip of the window, so it will be clipped to the parent window. Setting parent to be nullptr will make the window become a top level window.

If parent is a window created by fromWinId(), then the current window will be embedded inside parent, if the platform supports it.

void QWindow::setPosition ( const QPoint pt)

Sets the position of the window on the desktop to pt.

See also
position()
void QWindow::setPosition ( int  posx,
int  posy 
)

Sets the position of the window on the desktop to posx, posy.

See also
position()
void QWindow::setScreen ( QScreen screen)

Sets the screen on which the window should be shown. If the window has been created, it will be recreated on the screen. If the screen is part of a virtual desktop of multiple screens, the window can appear on any of the screens returned by QScreen::virtualSiblings().

This method only works for top level windows.

See also
screen(), QScreen::virtualSiblings()
void QWindow::setSizeIncrement ( const QSize size)

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.

See also
setBaseSize(), setMinimumSize(), setMaximumSize()
void QWindow::setSurfaceType ( SurfaceType  surfaceType)

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

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

See also
QBackingStore, QOpenGLContext, create(), destroy()
void QWindow::setTransientParent ( QWindow *  parent)

Sets the transient parent. This is a hint to the window manager that this window is a dialog or pop-up on behalf of the given window. In order for the window to be centered above its transient parent, it may also be necessary to call setFlags() with a suitable Qt::WindowType.

See also
transientParent(), parent()
void QWindow::setVisible ( bool  visible)
slot

Sets the value of the property to visible.

void QWindow::setVulkanInstance ( QVulkanInstance instance)

Configures this window to render using the instance. The given instance must remain valid for the lifetime of this QWindow.

void QWindow::setWindowState ( Qt::WindowState  state)

Sets 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 Qt::WindowActive is not an accepted parameter.

See also
showNormal(), showFullScreen(), showMinimized(), showMaximized()
void QWindow::show ( )
slot

Shows the window. This is equivalent to calling showFullScreen(), showMaximized(), or showNormal(), depending on the platform's default behavior for the window type and flags.

See also
showFullScreen(), showMaximized(), showNormal(), hide(), QStyleHints::showIsFullScreen(), flags()
void QWindow::showEvent ( QShowEvent event)
protectedvirtual

Override this to handle show events (event). The method 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.

void QWindow::showFullScreen ( )
slot

Shows the window as fullscreen. Equivalent to calling setWindowState(Qt::WindowFullScreen) and then setVisible(true).

See also
setWindowState(), setVisible()
void QWindow::showMaximized ( )
slot

Shows the window as maximized. Equivalent to calling setWindowState(Qt::WindowMaximized) and then setVisible(true).

See also
setWindowState(), setVisible()
void QWindow::showMinimized ( )
slot

Shows the window as minimized. Equivalent to calling setWindowState(Qt::WindowMinimized) and then setVisible(true).

See also
setWindowState(), setVisible()
void QWindow::showNormal ( )
slot

Shows the window as normal, i.e. neither maximized, minimized, nor fullscreen. Equivalent to calling setWindowState(Qt::WindowNoState) and then setVisible(true).

See also
setWindowState(), setVisible()
QSize QWindow::size ( ) const
inlineoverridevirtual

Returns the size of the window excluding any window frame.

See also
resize()

Implements QSurface::size()

QSize QWindow::sizeIncrement ( ) const

Returns the size increment of the window.

See also
setSizeIncrement()
QWindow::SurfaceType QWindow::surfaceType ( ) const
overridevirtual

Returns the surface type of the window.

See also
setSurfaceType()

Implements QSurface::surfaceType()

void QWindow::tabletEvent ( QTabletEvent event)
protectedvirtual

Override this to handle tablet press, move, and release events (event). Proximity enter and leave events are not sent to windows, they are delivered to the application instance.

QWindow * QWindow::transientParent ( ) const

Returns the transient parent of the window.

See also
setTransientParent(), parent()
Qt::WindowType QWindow::type ( ) const

void QWindow::touchEvent(QTouchEvent *event)

Override this to handle touch events (event).

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

See also
flags(), setFlags()
void QWindow::unsetCursor ( )

Restores the default arrow cursor for this window.

QVulkanInstance * QWindow::vulkanInstance ( ) const

Returns the Vulkan instance for this QWindow.

void QWindow::wheelEvent ( QWheelEvent event)
protectedvirtual

Override this mtheod to handle mouse wheel or other wheel events for the given event.

Qt::WindowState QWindow::windowState ( ) const

Returns the screen occupation state of the window.

See also
setWindowState()
void QWindow::windowStateChanged ( Qt::WindowState  windowState)
signal

This signal is emitted when the windowState changes, either by being set explicitly with setWindowState(), or automatically when the user clicks one of the titlebar buttons or by other means.

WId QWindow::winId ( ) const

Returns the window's platform id. For platforms where this id might be useful, the value returned will uniquely represent the window inside the corresponding screen.

See also
screen()

Property Documentation

QWindow::active

The active status of the window.

See also
requestActivate()
PropertiesClass Methods
read isActive
notify activeChanged
revision
QWindow::contentOrientation

The orientation of the window's contents. This is a hint to the window manager in case it needs to display additional content like popups, dialogs, status bars, or similar in relation to the window.

The recommended orientation is QScreen::orientation() but an application does not have to support all possible orientations, and thus can opt to ignore the current screen orientation.

The difference between the window and the content orientation determines how much to rotate the content by. QScreen::angleBetween(), QScreen::transformBetween(), and QScreen::mapBetween() can be used to compute the necessary transform.

The default value is Qt::PrimaryOrientation.

PropertiesClass Methods
read contentOrientation
write reportContentOrientationChange
notify contentOrientationChanged
QWindow::flags

This property contains window flags for the window. The window flags control the window's appearance in the windowing system, whether it's a dialog, popup, or a regular window, and whether it should have a title bar, etc.

The actual window flags might differ from the flags set with setFlags() if the requested flags could not be fulfilled.

PropertiesClass Methods
read flags
write setFlags
QWindow::height

The height of the window's geometry.

PropertiesClass Methods
read height
write setHeight
notify heightChanged
QWindow::maximumHeight

The maximum height of the window's geometry

PropertiesClass Methods
read maximumHeight
write setMaximumHeight
notify maximumHeightChanged
QWindow::maximumWidth

The maximum width of the window's geometry.

PropertiesClass Methods
read maximumWidth
write setMaximumWidth
notify maximumWidthChanged
QWindow::minimumHeight

The minimum height of the window's geometry.

PropertiesClass Methods
read minimumHeight
write setMinimumHeight
notify minimumHeightChanged
QWindow::minimumWidth

The minimum width of the window's geometry.

PropertiesClass Methods
read minimumWidth
write setMinimumWidth
notify minimumWidthChanged
QWindow::modality

A modal window prevents other windows from receiving input events. CopperSpice supports two types of modality: Qt::WindowModal and Qt::ApplicationModal.

By default, this property is Qt::NonModal.

See also
Qt::WindowModality
PropertiesClass Methods
read modality
write setModality
notify modalityChanged
QWindow::opacity

The opacity of the window in the windowing system. If the windowing system supports window opacity, this can be used to fade the window in and out, or to make it semitransparent.

A value of 1.0 or above is treated as fully opaque, whereas a value of 0.0 or below is treated as fully transparent. Values in between represent varying levels of translucency between the two extremes.

The default value is 1.0.

PropertiesClass Methods
read opacity
write setOpacity
notify opacityChanged
revision
QWindow::title

This property is the window's title in the windowing system.

The window title might appear in the title area of the window decorations, depending on the windowing system and the window flags. It might also be used by the windowing system to identify the window in other contexts, such as in the task switcher.

See also
flags()
PropertiesClass Methods
read title
write setTitle
notify windowTitleChanged
QWindow::visibility

This property describes the way the window will be displayed. The QWindow::Visibility enum describes whether the window should appear in the windowing system as normal, minimized, maximized, fullscreen, or hidden.

To set the visibility to QWindow::AutomaticVisibility means to give the window a default visible state, which might be fullscreen or windowed depending on the platform. When reading the visibility property you will always get the actual state, never AutomaticVisibility.

PropertiesClass Methods
read visibility
write setVisibility
notify visibilityChanged
revision
QWindow::visible

This property controls the visibility of the window in the windowing system.

By default, the window is not visible, you must call setVisible(true), or show() or similar to make it visible.

See also
show()
PropertiesClass Methods
read isVisible
write setVisible
notify visibleChanged
QWindow::width

The width of the window's geometry.

PropertiesClass Methods
read width
write setWidth
notify widthChanged
QWindow::x

The x position of the window's geometry.

PropertiesClass Methods
read x
write setX
notify xChanged
QWindow::y

The y position of the window's geometry.

PropertiesClass Methods
read y
write setY
notify yChanged