Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QFileDialog with strange behavior
Quorn Julio last edited by Quorn Julio
first of all i develop under mac 10.14.6 (Mojave) using Qt 5.15.0.
in my program i use QFileDialog as follow:
this->fileDialog = new QFileDialog(window()); this->fileDialog->setWindowFlags(Qt::Sheet); this->fileDialog->setWindowModality(Qt::WindowModal); this->fileDialog->setModal(true); ... this->fileDialog->exec()
The strange thing is here that the dialog opens on the right position but than jumps down with a certain offset Y.
I try to "fix" the position of QFileDialog with setGeometry(0, 0, 500, 400) but this without success.
I am grateful for any help.
Pl45m4 last edited by Pl45m4
this->fileDialog = new QFileDialog(window());
This looks weird... Replace
thisor some other valid parent and try if your dialog "jumps" again
This is redundant... first line sets
WindowModal, the second overrides this setting with
ApplicationModal, which is pretty much the same in a parent-child-hierarchy
And there is also this:
Indicates that the window is a sheet on macOS. Since using a sheet implies window modality, the recommended way is to use QWidget::setWindowModality(), or QDialog::open(), instead.
So I guess, using
setModal(true)is not recommended on MacOS.
If this causes your jump?! I don't know :)
Quorn Julio last edited by
Thank you so much!
works properly / as expected. i wonder why
I would have expected the same behavior.