Say hello to QPlatformWindow

Just a short notice that the platform_window branch is being merged back into the 4.7 branch in the lighthouse repository . Note: it can take up to 12 hours before it is available on Gitorious.

This means that QPlatformIntegration has slightly altered API:
One new function:
virtual QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const = 0;
and the createWindowSurface function has a new signature:
virtual QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const = 0;

The function createPlatformWindow will be called before createWindowSurface. The QPlatformWindow can be retrieved from the widget using:

QPlatformWindow *QWidget::platformWindow() const

The WId can always be retrieved in the createWindowSurface function by retrieving the QPlatformWindow from the widget, but is supplied as an argument to give a stronger impression that it is now time to create the QWindowSurface subclass for a specific window.

Also, QWindowSurface in Lighthouse no longer has
setGeometry(const QRect &)
geometry()

but instead it has the functions
resize(const QSize &)
size()

resize() will be called after a call to QPlatformWindow::setGeometry(const QRect &).

The resize function should not be that interesting for implementations where WindowManagers controlls the window surface, but if your managing the surface in the plugin then a nice pattern to follow would be to delete the painting surface in the resize function and allocating a new painting surface in beginPaint().

Since this is my first blogpost here it makes also sense for me to note that: QBlittable lives in the lighthouse repository.
Please see:
src/gui/painting/qblittable_p.h
for the api of a blittable.

It is mainly being used in the DirectFb platform plugin, but there is also an example for how to use it with a normal graphicssystem:
src/plugins/graphicssystems/blittable

and there is also a example to use it with QWS:
src/plugins/gfxdrivers/blittableqvfb

I'm still not overenthusiastic about the name QBlittable, but I believe the general API for using it will not change much.


Blog Topics:

Comments