Say hello to QPlatformWindow

Published Wednesday April 21st, 2010
1 Comment on Say hello to QPlatformWindow
Posted in Lighthouse, Painting

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.

Do you like this? Share it
Share on LinkedInGoogle+Share on FacebookTweet about this on Twitter

Posted in Lighthouse, Painting

One comment

taipan says:

Good job.
Thank you.

Commenting closed.

Get started today with Qt Download now