QProgressBar in a new window
Hi,
Whenever my program is doing something that takes a long time, I'd like it to show a progress bar. Every time progress bar is called, I'd like the program to open a new small window on top of the main window and show a progress bar within that window. When the progress bar reaches 100%, I'd like the progress bar window to automatically close.
What is the best way to do this? Is there an easy way or do I need to generate a new widget for that? So far I've done everything with one widget only. How do you share information between two widgets/windows?
I'd be very thankful for any help!
Re: QProgressBar in a new window
Re: QProgressBar in a new window
Check out QProgressDialog. You can also do it yourself by subclassing QDialog, but maybe the built-in class already provides the functionality you need.
To answer your question "how do you share information between two widgets/windows" you need to think about object composition. If your main window object "has-a" dialog object, then you should be able to easily connect signals/slots between them to pass information.