Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. QFileDialog's name filter not working as expected
Forum Updated to NodeBB v4.3 + New Features

QFileDialog's name filter not working as expected

Scheduled Pinned Locked Moved C++ Gurus
3 Posts 3 Posters 2.2k 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.
  • T Offline
    T Offline
    timyap
    wrote on last edited by
    #1

    I am trying to set the filter used in a file dialog. The filter seems to work fine except for the extension '.nii.gz'. On Mac OS X (Mavericks), all files with extension '.nii.gz' are grayed out. Any idea what's wrong? Thanks!

    @ QFileDialog fileDialog;

    QString fileName =
    fileDialog.getOpenFileName(NULL,
    tr("Open File"), "",
    tr("Images (*.nii.gz *.nii *.mha *.mhd *.nrrd *.nhdr)"));
    @

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      You do not need an object to use getOpenFileName(), it is a static function!

      Perhaps you have hit some limitation of the QFileDialog. I have searched the documentation, but it is silent on this case. You may need to file a bug report.

      (Z(:^

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

        Hi and welcome to devnet,

        It seems to be a limitation of OS X's native file dialog though sierdzio has a point about your usage of the function.

        The bug report about it can be found "here":https://bugreports.qt-project.org/browse/QTBUG-38303

        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