PDA

View Full Version : Multiple Message Boxes



chris_helloworld
14th April 2011, 10:51
Theres probably many ways of solving this problem, but I'm wondering what is considered 'best practice' or a good design pattern.

Consider a GUI doing various tasks in background, any of which could error and you want to display a messagebox to the user. Obviously you cant have multiple modal windows, so what is the best way to handle the situation where several of your threads have errored ? (or even the scenario where the GUI is currently displaying another modal dialog, and a thread errors and wants to show a message) ?

stampede
14th April 2011, 11:41
I would probably have one window for error reporting, and connect error signals of worker threads to one slot in main thread with QueuedConnection, so all incoming error messages would be appended and displayed in one window instead of multiple popups. Imagine that you need to click 6+ times in a row because some worker threads reported errors, IMHO better approach is to display them all in single (maybe list) widget.

chris_helloworld
14th April 2011, 12:04
Sounds reasonable to me, cheers.