[Development] Virtual GUI framework

Agocs Laszlo Laszlo.Agocs at digia.com
Thu Nov 7 21:28:43 CET 2013


The "Ideally, this would still capture information about what is being drawn" part is a bit more tricky but is perfectly doable. When it comes to raster painting, pretty much all existing platform plugins direct it into a QImage. That will not be suitable here since you are interested in the QPainter commands that make up the window contents, not the final output image.

To do this one would subclass QPaintDevice and QPaintEngine, and make the backing store implementation return the custom paint device. The engine can then output whatever is needed for each drawTextItem, drawPolygon, drawPixmap, etc. call. This approach has been successfully used to turn (widget-based) Qt apps into outputting HTML canvas drawing code for example.

Cheers,
Laszlo
________________________________________
From: development-bounces+laszlo.agocs=digia.com at qt-project.org [development-bounces+laszlo.agocs=digia.com at qt-project.org] on behalf of David Boddie [davidb at met.no]
Sent: Thursday, November 07, 2013 7:40 PM
To: development at qt-project.org
Subject: Re: [Development] Virtual GUI framework

On Thu Nov 7 15:22:31 CET 2013, Rand McRanderson wrote:

> Since Qt is a cross-platform GUI library, would it be possible to
> create a fake display system platform that would essentially stub out
> all of the display library dependencies. Ideally, this would still
> capture information about what is being draw, so that you could
> calculate what would be displayed hypothetically (this could be
> helpful for things such as generating pdf files based on calculated
> layout). At the very least this might provide a way for Qt to run a
> console application without bringing in libraries that may not be
> available for all environments (the key case here is Linux servers
> with display libraries disabled, Windows I'm not sure you can really
> disable display libraries, but I know that the Linux use-case comes up
> decently with servers).

The minimal case can be done with QPA, as Friedemann mentioned in his
reply. For my use case, I build minimal Qt libraries with only the
features I need and use a dummy screen plugin to keep everything happy.
The resulting library appears to run fine on servers without displays.

I'll try to put the code up somewhere tomorrow.

David
_______________________________________________
Development mailing list
Development at qt-project.org
http://lists.qt-project.org/mailman/listinfo/development



More information about the Development mailing list