Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QFileDialog::getOpenFileName Fails to Display Dialog with Native macOS
Forum Updated to NodeBB v4.3 + New Features

QFileDialog::getOpenFileName Fails to Display Dialog with Native macOS

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 46 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bobthebuilder
    wrote last edited by bobthebuilder
    #1

    Hi Qt Devs! I'm developing a desktop application in C++ on macOS Sequoia 15.5 with Qt 6.9.1. When I call QFileDialog::getOpenFileName from a class that inherits from QWidget while on the main thread no dialog appears and the function immediately returns an empty string. When I call QFileDialog::getOpenFileName with the QFileDialog::DontUseNativeDialog option, however, I do indeed get a dialog and can retrieve a file name. I would like to use the native dialog, is there some reason the call is not displaying a file dialog with the native version?

    In short, this code does not display a dialog on macOS:

    QFileDialog::getOpenFileName(this, tr("Please select a file."));
    

    But this code does display a dialog on macOS:

    QFileDialog::getOpenFileName(this, tr("Please select a file."), QString(), QString(), nullptr, QFileDialog::DontUseNativeDialog);
    

    Thanks!

    Edit: The same problem occurs with QFileDialog::getSaveFileName and QFileDialog::getExistingDirectory too. Other calls like QMessageBox::information do work as expected, however.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote last edited by
      #2

      Hi,

      Please provide a complete minimal example that shows that issue. This will allow people to test in the same conditions as you.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved