Back to Blog home

Say hello to QPlatformWindow

Published on Wednesday April 21, 2010 by Jørgen Lind in Lighthouse Painting | Comments

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

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

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:
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:

and there is also a example to use it with QWS:

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

Subscribe to Our Blog

Stay up to date with the latest marketing, sales and service tips and news.

The blog comment system has been migrated to a new platform. If you face any issues, please let us know via