[Interest] QPrintPreviewWidget

Roland Hughes roland at logikalsolutions.com
Tue Apr 4 13:24:07 CEST 2017


You know, "painting into an off screen image is not GUI related" 
__should__ be true. Haven't tried it since 4.8.x, but it certainly 
wasn't true back then. Desperately wanted to thread off the generating 
of many pixmaps which would be later BLITted onto the touch screen as 
needed by application. Nope nope nope nope. (Please, don't suggest 
alternatives to pre-loading. Embedded device, single core, no GPU trying 
to achieve 10 days of run-time battery life. Last I heard, we did it and 
we had a responsive GUI touchscreen.)

This "all things GUI in primary thread" philosophy has an awful lot of 
real world fallout, especially in the embedded world where RAM is fast 
but hardened storage is slooooooow. It also leads to some pretty 
horrible database interfaces, in particular when using spreadsheet/table 
models to scroll through networked/remote databases with millions of 
records where the connection could require several seconds to respond. 
Yes, I've had to do some hacks to thread that stuff off, but the primary 
examples floating around out there show it all running in the GUI thread.

Roland


On 04/04/2017 01:47 AM, interest-request at qt-project.org wrote:
> On 04/01/2017 09:48 AM, Dan Allen wrote:
>> Hi Bill,
>>
>> I agree, however when the print is quite complex it makes the GUI very
>> unresponsive.
>>
>> Painting into an off screen image is not GUI related. The print preview could
>> show something like "Generating Preview" while a background thread generates it
>> and then show it when it's ready for example. This would prevent the GUI from
>> seeming unresponsive to the user. I wasn't sure if there was a current method to
>> do something like this.
>>
> Yes. We agree that the actual printing is non GUI, but if you want
> to show a print preview or progress meter, that is GUI and needs
> to stay in the main thread.
>
> So, something like:
> - Create a progress meter dialog.
> - Start your printing in a sub thread.
> - The main thread waits, perhaps in a sub-QEventLoop, servicing events.
> - After a few seconds, if printing has not completed, show the dialog.
> - The sub-event loop monitors the printing process with a thread safe
>     communication mechanism, like signals and slots.
> - When the printing completes, close the dialog.
> - Exit your sub-event loop.
>
>> Thanks,
>>
>> Dan Allen.

-- 
Roland Hughes, President
Logikal Solutions
(630)-205-1593

http://www.theminimumyouneedtoknow.com
http://www.infiniteexposure.net
http://www.johnsmith-book.com
http://www.logikalblog.com
http://www.interestingauthors.com/blog
http://lesedi.us/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170404/11277bfe/attachment.html>


More information about the Interest mailing list