4

I'm experiencing an issue with a Qt app on Mac OS X 10.10.5, whereby a QFileDialog will not close properly when canceled. While this may be a bug in Qt, I only see this bug when running the app as a normal user would, e.g. opening it in the Finder (or via command line open). If I launch the app via Xcode or by calling the binary directly, there is no issue.

  1. Launch the app via calling the binary directly on the command line or within Xcode, e.g. ./MyApp.app/Contents/MacOS/MyApp

  2. Launch the app via the Finder or open, e.g. open ./MyApp.app

What are the differences between these two methods - and how does it impact a running application?

Dan
  • 1,258
  • 1
  • 10
  • 22
  • Can you elaborate on what exactly happens when the dialog doesn't close properly? – Kuba hasn't forgotten Monica Sep 16 '15 at 12:14
  • Please post a self-contained test case, and mention what exact Qt version you are using. If I can reproduce it, I'll ask you to file a bug report with that very test case. – Kuba hasn't forgotten Monica Sep 17 '15 at 15:26
  • I've posted some test code on [github](https://github.com/surething/filedialog) … and have reproduced it using a self-built Qt 5.3 and a Homebrew-installed Qt 5.5 – Dan Sep 20 '15 at 20:31
  • Also, an interesting issue is that this only affects the app if `QFileDialog::open` or `QFileDialog::show` is used … and not if the convenience static methods `QFileDialog::get*` are used. – Dan Sep 20 '15 at 20:40
  • While the source of the problem wasn't discovered, a workaround was achieved using QML file dialogs instead of `QFileDialog`. – Dan Oct 13 '15 at 00:28

1 Answers1

0

The major difference is the working folder. You don't have any control over what it is, but it will be different between the two invocations.

What directory are you showing the QFileDialog in? You should probably start in a well-defined place, like the user's home.

Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313
  • The dialog is set to open in certain well-defined locations on disk, among them the user's home. – Dan Sep 16 '15 at 00:11
  • Every time the file dialog is invoked (not in the example code), the directory in which to open is set. While it'd be great to see this uncover a bug in Qt, I'm interested in why the two different ways of launching the app results in different behaviour. – Dan Sep 20 '15 at 20:38