Important: Please read the Qt Code of Conduct -

QFileDialog's name filter not working as expected

  • 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 =
    tr("Open File"), "",
    tr("Images (*.nii.gz *.nii *.mha *.mhd *.nrrd *.nhdr)"));

  • Moderators

    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.

  • Lifetime Qt Champion

    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":

Log in to reply