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. Directory-selection file dialog looks odd on Mac

Directory-selection file dialog looks odd on Mac

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 1.1k Views
  • 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.
  • J Offline
    J Offline
    jdxjohn
    wrote on last edited by
    #1

    Our project files are a directory, so we want a directory-selection dialog for Windows/Mac.

    It works but on Mac it doesn't look that intuitive:
    0_1532531802991_c6897169-5cfe-4935-bee5-7faa3092f424-image.png

    You can still see files in the folder but they are disabled. I'm not an expert Mac user so maybe this is just how it works on Mac, but the Windows version is just a bit neater:
    0_1532531992253_32f3deba-11e7-43ff-b46d-9016efa4a4d7-image.png

    Is there some other flag we should use or is this just how it is?

    JonBJ K 2 Replies Last reply
    0
    • J jdxjohn

      Our project files are a directory, so we want a directory-selection dialog for Windows/Mac.

      It works but on Mac it doesn't look that intuitive:
      0_1532531802991_c6897169-5cfe-4935-bee5-7faa3092f424-image.png

      You can still see files in the folder but they are disabled. I'm not an expert Mac user so maybe this is just how it works on Mac, but the Windows version is just a bit neater:
      0_1532531992253_32f3deba-11e7-43ff-b46d-9016efa4a4d7-image.png

      Is there some other flag we should use or is this just how it is?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @jdxjohn

      • Do you use QFileDialog::ShowDirsOnly or QFileDialog::DirectoryOnly ?
      • Do you use QFileDialog::DontUseNativeDialog ?
      • Do you use http://doc.qt.io/qt-5/qfiledialog.html#getExistingDirectory ?

      Don't forget:

      On Windows and macOS, this static function will use the native file dialog and not a QFileDialog. However, the native Windows file dialog does not support displaying files in the directory chooser. You need to pass DontUseNativeDialog to display files using a QFileDialog.

      In effect, I think you want what Windows gives you, you need one of those "directory only" flags for MacOS?

      J 1 Reply Last reply
      3
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Even if that looks unintuitive for you, it's the style of macOS's Finder. You can change how the files are shown by clicking the other two buttons on the left of the one that is active in your picture.

        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
        1
        • J jdxjohn

          Our project files are a directory, so we want a directory-selection dialog for Windows/Mac.

          It works but on Mac it doesn't look that intuitive:
          0_1532531802991_c6897169-5cfe-4935-bee5-7faa3092f424-image.png

          You can still see files in the folder but they are disabled. I'm not an expert Mac user so maybe this is just how it works on Mac, but the Windows version is just a bit neater:
          0_1532531992253_32f3deba-11e7-43ff-b46d-9016efa4a4d7-image.png

          Is there some other flag we should use or is this just how it is?

          K Offline
          K Offline
          kenchan
          wrote on last edited by
          #4

          @jdxjohn
          That it the native Mac dialog and that is how it is. Unlike windows it shows the file types you want to select (filters) darker and selectable, others lighter and non-selectable.
          As you say it is rather un-intuitive compared to how windows does it.

          1 Reply Last reply
          0
          • JonBJ JonB

            @jdxjohn

            • Do you use QFileDialog::ShowDirsOnly or QFileDialog::DirectoryOnly ?
            • Do you use QFileDialog::DontUseNativeDialog ?
            • Do you use http://doc.qt.io/qt-5/qfiledialog.html#getExistingDirectory ?

            Don't forget:

            On Windows and macOS, this static function will use the native file dialog and not a QFileDialog. However, the native Windows file dialog does not support displaying files in the directory chooser. You need to pass DontUseNativeDialog to display files using a QFileDialog.

            In effect, I think you want what Windows gives you, you need one of those "directory only" flags for MacOS?

            J Offline
            J Offline
            jdxjohn
            wrote on last edited by
            #5

            @JonB we definitely use the native dlgs - we had a custom one but it just wasn't right.

            We use

            qt.QFileDialog.ShowDirsOnly
            

            Have I correctly understood that there's just no way to make a native Mac directory-picking dialog not show files? i.e. the flag I'm passing is ignored on Mac?

            If it insists on showing the files I might as well show our internal project file as selectable as well, and grey out the others - right now users know MRML is the file they previously had to go searching around for so when they see an MRML file some are trying to open that rather than the enclosing directory.

            As a side question, can I trivially turn a regular directory into some kind of archive on Mac (and I suppose windows) the way an application package does it, perhaps?

            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