QFileDialog::getOpenFileName - dialog not closing on file select under OS X
-
wrote on 30 Mar 2015, 23:09 last edited by
in using the QFileDialog::getOpenFileName dialog to select a file under OS X, when clicking on OK (or double clicking the file) to select the name, the file name is passed correctly and the code continues execution, however the actual dialog remains on the screen and unresponsive. This same code works fine under windows and Linux:
QString filename = QFileDialog::getOpenFileName(this, "Open Study", settings.value("GeneralSettings/SavePath").toString(), "Study File (*.ssd);;All Files(*)"); if(!filename.isEmpty()) { OpenFile(filename); }
Any thoughts as to why this may be happening?
Rob
-
wrote on 30 Mar 2015, 23:49 last edited by
Which version are you using?
I'm using:
QMake version 3.0
Using Qt version 5.4.1and It works properly.
-
Which version are you using?
I'm using:
QMake version 3.0
Using Qt version 5.4.1and It works properly.
-
wrote on 31 Mar 2015, 12:44 last edited by
Can't you update your Qt to see if the error is version specific?
-
wrote on 31 Mar 2015, 17:20 last edited by
@Magnum A valid observation... obviously tired by the end of the day yesterday. I have updated everything and am still receiving the same results.
Of note: the OpenFile function opens a file in an MDISubWindow. I have since noticed that the dialog closes if another system dialog overrides it from the main form.
-
wrote on 31 Mar 2015, 18:38 last edited by
I am using Qt 5.4.0 on Yosemite and have not seen this problem. I use 'getOpenFileName()' on lots of projects.
QMake Version: 3.0
G++ Version: 6.0 (clang-600-0.57)
Target: x86_64The MDISubWindow doesn't sound right (I assume this means it opens in a child window of the parent and not a typical modal dialog). Maybe some window flags are being inherited from the parent widget?
-
wrote on 31 Mar 2015, 21:11 last edited by
Hi,
is your code executed in eventLoop??
Have you calledQApplication::exec()
? -
wrote on 1 Apr 2015, 22:07 last edited by
@mcosta It is a standard QT application with a (mostly) unaltered main loop:
int main(int argc, char *argv[]) { QApplication a(argc, argv); QCoreApplication::setOrganizationName("###########"); QCoreApplication::setOrganizationDomain("############"); QCoreApplication::setApplicationName("##########"); QCoreApplication::setApplicationVersion("############"); frmMain w; w.show(); return a.exec(); }
-
wrote on 1 Apr 2015, 22:11 last edited by
Can you try to comment the line
OpenFile(filename);and use a qDebug there instead, this function could be the problem
Thanks
8/9