PDA

View Full Version : ActiveWindow changes after closing QFileDialog



mischi
12th July 2006, 08:52
Hello,

my program uses QWorkspace and adds new windows to this workspace.


Child *child = new Child(this,0);
workspace->addWindow(child);

When closing the QFileDialog of one of the windows, the active window is resetted to window nr.1 of the windowlist (creation order).


QString fileName = QFileDialog::getOpenFileName(
this,
tr("Open"),
"/path",
tr("Textfile (*.txt)"));

I've got no clue why the active window changes... need help, please!

Chicken Blood Machine
12th July 2006, 18:00
Which widget do you parent the QFileDialog to?

It should be the QMainWindow.

mischi
13th July 2006, 12:34
it doesn't matter which parent is setted...
(i tried 0,this and your suggestion)

focusing just works with my self-made dialogs, not with the file dialog.

mischi
13th July 2006, 13:45
i've read the documentation again and it seems to be an unmanged qt problem:


Under Windows and Mac OS X, this static function will use the native file dialog and not a QFileDialog.

Returning to application after native file dialog call ends up with focusing the "wrong" window.

Not using the static method works perfectly.