Qt 4.8
Public Functions | Protected Variables | List of all members
QPlatformWindow Class Reference

The QPlatformWindow class provides an abstraction for top-level windows. More...

#include <qplatformwindow_qpa.h>

Inheritance diagram for QPlatformWindow:
QBBWindow QCocoaWindow QDirectFbWindow QEglFSWindow QFbWindow QOpenKODEWindow QUIKitWindow QVFbWindow QWaylandWindow QXcbWindow QXlibWindow

Public Functions

virtual QRect geometry () const
 Returnes the current geometry of a window. More...
 
virtual QPlatformGLContextglContext () const
 Reimplement to return the glContext associated with the window. More...
 
virtual void lower ()
 Reimplement to be able to let Qt lower windows to the bottom of the desktop. More...
 
 QPlatformWindow (QWidget *tlw)
 Constructs a platform window with the given top level widget. More...
 
virtual void raise ()
 Reimplement to be able to let Qt rais windows to the top of the desktop. More...
 
virtual void requestActivateWindow ()
 Reimplement to let Qt be able to request activation/focus for a window. More...
 
virtual void setGeometry (const QRect &rect)
 This function is called by Qt whenever a window is moved or the window is resized. More...
 
virtual void setOpacity (qreal level)
 Reimplement to be able to let Qt set the opacity level of a window. More...
 
virtual void setParent (const QPlatformWindow *window)
 This function is called to enable native child widgets in QPA. More...
 
virtual void setVisible (bool visible)
 Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false. More...
 
virtual Qt::WindowFlags setWindowFlags (Qt::WindowFlags flags)
 Requests setting the window flags of this surface to type. More...
 
virtual void setWindowTitle (const QString &title)
 Reimplement to set the window title to title. More...
 
QWidgetwidget () const
 Returnes the widget which belongs to the QPlatformWindow. More...
 
virtual Qt::WindowFlags windowFlags () const
 Returns the effective window flags for this surface. More...
 
virtual WId winId () const
 Reimplement in subclasses to return a handle to the native window. More...
 
virtual ~QPlatformWindow ()
 Virtual destructor does not delete its top level widget. More...
 

Protected Variables

QScopedPointer< QPlatformWindowPrivated_ptr
 

Detailed Description

The QPlatformWindow class provides an abstraction for top-level windows.

Since
4.8
Warning
This function is not part of the public interface. This function is under development and subject to change.

The QPlatformWindow abstraction is used by QWidget for all its top level widgets. It is being created by calling the createPlatformWindow function in the loaded QPlatformIntegration instance.

QPlatformWindow is used to signal to the windowing system, how Qt persieves its frame. However, it is not concerned with how Qt renders into the window it represents.

Top level QWidgets(tlw) will always have a QPlatformWindow. However, it is not necessary for all tlw to have a QWindowSurface. This is the case for QGLWidget. And could be the case for widgets where some 3.party renders into it.

The platform specific window handle can be retrieved by the winId function.

QPlatformWindow is also the way QPA defines how native child windows should be supported through the setParent function.

The only way to retrieve a QPlatformGLContext in QPA is by calling the glContext() function on QPlatformWindow.

See also
QWindowSurface, QWidget

Definition at line 61 of file qplatformwindow_qpa.h.

Constructors and Destructors

◆ QPlatformWindow()

QPlatformWindow::QPlatformWindow ( QWidget tlw)

Constructs a platform window with the given top level widget.

Definition at line 59 of file qplatformwindow_qpa.cpp.

61 {
63  d->tlw = tlw;
64  tlw->setPlatformWindow(this);
65 }
double d
Definition: qnumeric_p.h:62
The QPlatformWindow class provides an abstraction for top-level windows.
#define Q_D(Class)
Definition: qglobal.h:2482
QScopedPointer< QPlatformWindowPrivate > d_ptr

◆ ~QPlatformWindow()

QPlatformWindow::~QPlatformWindow ( )
virtual

Virtual destructor does not delete its top level widget.

Definition at line 70 of file qplatformwindow_qpa.cpp.

71 {
72 }

Functions

◆ geometry()

QRect QPlatformWindow::geometry ( ) const
virtual

◆ glContext()

QPlatformGLContext * QPlatformWindow::glContext ( ) const
virtual

Reimplement to return the glContext associated with the window.

Reimplemented in QUIKitWindow, QXlibWindow, QBBWindow, QXcbWindow, QOpenKODEWindow, QEglFSWindow, QWaylandEglWindow, QWaylandReadbackEglWindow, QWaylandReadbackGlxWindow, QWaylandXCompositeEGLWindow, QWaylandXCompositeGLXWindow, and QWaylandShmWindow.

Definition at line 195 of file qplatformwindow_qpa.cpp.

Referenced by QWaylandGLWindowSurface::flush().

196 {
197  return 0;
198 }

◆ lower()

void QPlatformWindow::lower ( )
virtual

Reimplement to be able to let Qt lower windows to the bottom of the desktop.

Reimplemented in QFbWindow, QXlibWindow, QBBWindow, QXcbWindow, QOpenKODEWindow, and QDirectFbWindow.

Definition at line 163 of file qplatformwindow_qpa.cpp.

163 { qWarning("This plugin does not support lower()"); }
Q_CORE_EXPORT void qWarning(const char *,...)

◆ raise()

void QPlatformWindow::raise ( )
virtual

Reimplement to be able to let Qt rais windows to the top of the desktop.

Reimplemented in QFbWindow, QXlibWindow, QBBWindow, QXcbWindow, QOpenKODEWindow, and QDirectFbWindow.

Definition at line 158 of file qplatformwindow_qpa.cpp.

158 { qWarning("This plugin does not support raise()"); }
Q_CORE_EXPORT void qWarning(const char *,...)

◆ requestActivateWindow()

void QPlatformWindow::requestActivateWindow ( )
virtual

Reimplement to let Qt be able to request activation/focus for a window.

Some window systems will probably not have callbacks for this functionality, and then calling QWindowSystemInterface::handleWindowActivated(QWidget *w) would be sufficient.

If the window system has some event handling/callbacks then call QWindowSystemInterface::handleWindowActivated(QWidget *w) when the window system gives the notification.

Default implementation calls QWindowSystem::handleWindowActivated(QWidget *w)

Reimplemented in QXlibWindow, QBBWindow, and QXcbWindow.

Definition at line 187 of file qplatformwindow_qpa.cpp.

188 {
190 }
static void handleWindowActivated(QWidget *w)
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.

◆ setGeometry()

void QPlatformWindow::setGeometry ( const QRect rect)
virtual

This function is called by Qt whenever a window is moved or the window is resized.

The resize can happen programatically(from ie. user application) or by the window manager. This means that there is no need to call this function specifically from the window manager callback, instead call QWindowSystemInterface::handleGeometryChange(QWidget *w, const QRect &newRect);

Reimplemented in QFbWindow, QUIKitWindow, QXlibWindow, QVFbWindow, QBBWindow, QOpenKODEWindow, QXcbWindow, QWaylandReadbackEglWindow, QDirectFbWindow, QEglFSWindow, QCocoaWindow, QWaylandReadbackGlxWindow, QWaylandEglWindow, QWaylandXCompositeEGLWindow, and QWaylandXCompositeGLXWindow.

Definition at line 89 of file qplatformwindow_qpa.cpp.

Referenced by QWaylandWindow::configure(), QXcbWindow::handleConfigureNotifyEvent(), QBBWindow::offset(), QWaylandReadbackGlxWindow::setGeometry(), QWaylandEglWindow::setGeometry(), QWaylandXCompositeEGLWindow::setGeometry(), QWaylandXCompositeGLXWindow::setGeometry(), QCocoaWindow::setGeometry(), QEglFSWindow::setGeometry(), QDirectFbWindow::setGeometry(), QWaylandReadbackEglWindow::setGeometry(), QXcbWindow::setGeometry(), QBBWindow::setGeometry(), QVFbWindow::setGeometry(), QXlibWindow::setGeometry(), QUIKitWindow::setGeometry(), and QFbWindow::setGeometry().

90 {
92  d->rect = rect;
93 }
double d
Definition: qnumeric_p.h:62
The QPlatformWindow class provides an abstraction for top-level windows.
#define Q_D(Class)
Definition: qglobal.h:2482

◆ setOpacity()

void QPlatformWindow::setOpacity ( qreal  level)
virtual

Reimplement to be able to let Qt set the opacity level of a window.

Reimplemented in QBBWindow, and QDirectFbWindow.

Definition at line 168 of file qplatformwindow_qpa.cpp.

169 {
170  Q_UNUSED(level);
171  qWarning("This plugin does not support setting window opacity");
172 }
Q_CORE_EXPORT void qWarning(const char *,...)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setParent()

void QPlatformWindow::setParent ( const QPlatformWindow parent)
virtual

This function is called to enable native child widgets in QPA.

It is common not to support this feature in Window systems, but can be faked. When this function is called all geometry of this platform window will be relative to the parent.

Reimplemented in QXlibWindow, QBBWindow, QWaylandWindow, QXcbWindow, and QWaylandEglWindow.

Definition at line 144 of file qplatformwindow_qpa.cpp.

Referenced by q_createNativeChildrenAndSetParent().

145 {
146  Q_UNUSED(parent);
147  qWarning("This plugin does not support setParent!");
148 }
Q_CORE_EXPORT void qWarning(const char *,...)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setVisible()

void QPlatformWindow::setVisible ( bool  visible)
virtual

Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false.

Reimplemented in QFbWindow, QXlibWindow, QBBWindow, QWaylandWindow, QXcbWindow, QOpenKODEWindow, QDirectFbWindow, and QCocoaWindow.

Definition at line 108 of file qplatformwindow_qpa.cpp.

109 {
110  Q_UNUSED(visible);
111 }
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setWindowFlags()

Qt::WindowFlags QPlatformWindow::setWindowFlags ( Qt::WindowFlags  flags)
virtual

Requests setting the window flags of this surface to type.

Returns the actual flags set.

Reimplemented in QFbWindow, QXlibWindow, QXcbWindow, and QDirectFbWindow.

Definition at line 116 of file qplatformwindow_qpa.cpp.

Referenced by QXcbWindow::setWindowFlags().

117 {
119  d->flags = flags;
120  return flags;
121 }
double d
Definition: qnumeric_p.h:62
The QPlatformWindow class provides an abstraction for top-level windows.
#define Q_D(Class)
Definition: qglobal.h:2482

◆ setWindowTitle()

void QPlatformWindow::setWindowTitle ( const QString title)
virtual

Reimplement to set the window title to title.

Reimplemented in QXlibWindow, and QXcbWindow.

Definition at line 153 of file qplatformwindow_qpa.cpp.

153 {}

◆ widget()

QWidget * QPlatformWindow::widget ( ) const

Returnes the widget which belongs to the QPlatformWindow.

Definition at line 77 of file qplatformwindow_qpa.cpp.

Referenced by QBBScreen::addWindow(), QBBWindow::buffer(), QWaylandWindow::configure(), QBBGLContext::createSurface(), QBBGLContext::destroySurface(), QBBGLContext::doneCurrent(), QXlibWindow::doSizeHints(), QBBWindow::frontBuffer(), QBBWindow::gainedFocus(), QBBGLContext::getProcAddress(), QWaylandEglWindow::glContext(), QXcbWindow::glContext(), QBBWindow::glContext(), QXlibWindow::glContext(), QXcbWindow::handleButtonPressEvent(), QXcbWindow::handleClientMessageEvent(), QXlibWindow::handleCloseEvent(), QXcbWindow::handleConfigureNotifyEvent(), QXlibWindow::handleEnterEvent(), QXcbWindow::handleEnterNotifyEvent(), QXcbWindow::handleExposeEvent(), QXcbWindow::handleFocusInEvent(), QXlibWindow::handleFocusInEvent(), QXlibWindow::handleLeaveEvent(), QXcbWindow::handleLeaveNotifyEvent(), QXcbWindow::handleMouseEvent(), QXlibWindow::handleMouseEvent(), QWaylandInputDevice::inputHandleButton(), QWaylandInputDevice::inputHandleKey(), QWaylandInputDevice::inputHandleKeyboardFocus(), QWaylandInputDevice::inputHandleMotion(), QWaylandInputDevice::inputHandlePointerFocus(), QBBWindow::lower(), QBBGLContext::makeCurrent(), QWaylandEglWindow::newSurfaceCreated(), QXlibWindow::paintEvent(), QBBWindow::post(), QBBGLContext::QBBGLContext(), QBBWindow::QBBWindow(), QDirectFbWindow::QDirectFbWindow(), QDri2Context::QDri2Context(), QBBWindow::raise(), QBBWindow::renderBuffer(), requestActivateWindow(), QBBWindow::requestActivateWindow(), QXlibWindow::resizeEvent(), QBBScreen::resizeNativeWidgetWindow(), QBBGLContext::resizeSurface(), QBBScreen::resizeTopLevelWindow(), QBBScreen::resizeWindows(), QBBWindow::setBufferSize(), QEglFSWindow::setGeometry(), QDirectFbWindow::setGeometry(), QOpenKODEWindow::setGeometry(), QBBWindow::setGeometry(), QVFbWindow::setGeometry(), QBBWindow::setOpacity(), QBBWindow::setParent(), QBBWindow::setScreen(), QXcbWindow::setVisible(), QBBWindow::setVisible(), QXlibWindow::setVisible(), QXlibWindow::setWindowFlags(), QBBGLContext::swapBuffers(), QBBScreen::topMostChildWindow(), QUIKitWindow::updateGeometryAndOrientation(), QCocoaWindow::windowDidResize(), QBBGLContext::~QBBGLContext(), and QBBWindow::~QBBWindow().

78 {
79  Q_D(const QPlatformWindow);
80  return d->tlw;
81 }
double d
Definition: qnumeric_p.h:62
The QPlatformWindow class provides an abstraction for top-level windows.
#define Q_D(Class)
Definition: qglobal.h:2482

◆ windowFlags()

Qt::WindowFlags QPlatformWindow::windowFlags ( ) const
virtual

Returns the effective window flags for this surface.

Reimplemented in QFbWindow, and QXlibWindow.

Definition at line 126 of file qplatformwindow_qpa.cpp.

127 {
128  Q_D(const QPlatformWindow);
129  return d->flags;
130 }
double d
Definition: qnumeric_p.h:62
The QPlatformWindow class provides an abstraction for top-level windows.
#define Q_D(Class)
Definition: qglobal.h:2482

◆ winId()

WId QPlatformWindow::winId ( ) const
virtual

Reimplement in subclasses to return a handle to the native window.

Reimplemented in QFbWindow, QXlibWindow, QBBWindow, QDirectFbWindow, QWaylandWindow, QXcbWindow, QOpenKODEWindow, QCocoaWindow, and QEglFSWindow.

Definition at line 135 of file qplatformwindow_qpa.cpp.

Referenced by q_createNativeChildrenAndSetParent(), and QXlibWindow::setParent().

135 { return WId(0); }
unsigned long WId
Definition: qwindowdefs.h:119

Properties

◆ d_ptr

QScopedPointer<QPlatformWindowPrivate> QPlatformWindow::d_ptr
protected

Definition at line 87 of file qplatformwindow_qpa.h.


The documentation for this class was generated from the following files: