[Qt-interest] QProgressDialog wont show correctely

Brad Howes howes at ll.mit.edu
Mon Feb 2 19:14:05 CET 2009


On Feb 2, 2009, at 12:57 PM, Paulo Jnkml wrote:

> QProgressDialog dialog("Progress", "Cancel", 0, 100);
>
> dialog.show(); //Calling this here only shows the bar, no button or  
> label.
>
> dialog.exec(); //This shows all correctly but, I can't call this  
> here because the next step will never be executed. (Unless there's a  
> non blocking call to exec)
>
> someFunctionWithCalbackForProgression 
> ( boost::bind(&QProgressDialog::setValue, &dialog, _1) ); //boost  
> free pub =)
>
> dialog.exec(); //Won't be of much use here.
>
> How can I make this dialog show itself completely without calling  
> the exec()?
> I was told "dialog.show()" should show the cancel and label.
> So this must be a bug.


Most likely the QProgressDialog needs to services some update events,  
and you are doing your work without periodically processing Qt's main  
event queue. My personal preference is to create a thread that does  
the work (with some means of indicating progress in a thread-safe  
manner) so that I do not block Qt's main event loop.

Brad

-- 
Brad Howes
Group 42
MIT Lincoln Laboratory • 244 Wood St. • Lexington, MA 02173
Phone: 781.981.5292 • Fax: 781.981.3495 • Secretary: 781.981.7420








More information about the Qt-interest-old mailing list