Qt-jambi-interest Archive, January 2008
Modal dialogs ?
Message 1 in thread
In the above code the code below the show() method is executed before
the user has closed the dialog. Is this a bug or is it a planned feature ?
I guess I can overload the closeEvent(...) in the dialog class and run
my code there, but it's more intuitive to set the dialog to modal.
QFileDialog dialog = new QFileDialog(container.getMaster()){};
dialog.setAcceptMode(QFileDialog.AcceptMode.AcceptSave);
dialog.setModal(true);
dialog.setFilter("All session files (*.session)");
dialog.show();
List<String> strings = dialog.selectedFiles();
I really hope this is a bug and not a feature :)
-=Børge
Message 2 in thread
Hi, Børge.
Børge Nygaard Austvold wrote:
>
> In the above code the code below the show() method is executed before
> the user has closed the dialog. Is this a bug or is it a planned
> feature ?
It's a feature :-)
The show() method will create a modal event loop for the dialog and
return control to the caller. What I assume you are looking for, is the
exec() method, which will block until the event loop of the dialog box
has closed.
So replace the "dialog.show();" line in your code with:
dialog.exec();
and it should behave as you expect.
-- Eskil