[Interest] Showing progress while doing "background" GUI work

Israel Brewster ijbrewster at alaska.edu
Tue May 10 18:28:20 CEST 2022


I have a Qt/PySide 5.15 application with an option to export an image to PDF. The function to create and export this image takes around 12 seconds or so to run, so I would like to display a “please wait” dialog with an indefinite progress bar or the like to let the user know things are still being processes.

Normally I would accomplish this by running the long-running process in a thread, so the GUI can update the progress bar, but since I am creating and painting widgets and the like I believe this to not be an option. I also considered peppering my code with calls to QApplication.processEvents() (though I know that’s frowned upon), but that doesn’t work anyway because the bulk of the time is spent in the QPainter.end() call, as it actually writes out the PDF.

Given that my heavy function works with GUI elements/painters, is there any way I can indicate to the user - other than just a static message with no indication of progress - that the application is still working?
---
Israel Brewster
Software Engineer
Alaska Volcano Observatory 
Geophysical Institute - UAF 
2156 Koyukuk Drive 
Fairbanks AK 99775-7320
Work: 907-474-5172
cell:  907-328-9145

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20220510/bd3c675b/attachment.htm>


More information about the Interest mailing list