Native QFileDialog in OSX with multi filters not updated



  • Hi all,

    The file list is not updated when a filter is selected via the popup menu, so the selectable items stay grayed, and the very weird thing is that dispite there are grayed there are selectable !
    Very disturbing user experience ...

    You can see this behavior in QtCreator itself with " Open File With" in the File menu.
    Any workaround to force the items list to redraw ?

    I'm on OSX 10.9, Qt 5.6


  • Lifetime Qt Champion

    Hi,

    Can you provide a minimal compilable example that reproduces that behavior ?



  • @SGaist said in Native QFileDialog in OSX with multi filters not updated:

    Hi,

    Can you provide a minimal compilable example that reproduces that behavior ?

    Very simple:

    #include <QApplication>
    #include <QFileDialog>
    #include <QString>
    
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
        const QString filters = "*.png;;*.jpg";
        QString filepath=QFileDialog::getOpenFileName(0, 0, 0, filters);
    
        return 0;
    }
    

    I'm using OSX 10.9 Mavericks, Qt 5.6.1 and 5.7.1
    This bug exists in all Qt apps, for example VirtualBox.
    In QtCreator main menu, select File->Open File With
    and change the type of file with the popup menu button, the file list is not updated.
    This bug doesn't occur on Ubuntu.



  • I tried this on my system and it worked. Qt 5.6.0 OSX 10.10.5. I did have Mavericks on my laptop a few years ago and don't notice any problem. I don't have 5.6.1 or 5.7.1 so I can't test this.

    I noticed a difference between your filters and ones I use (placement of the semi-colons). This is an example of a filter that I just tested with. When I change the selection of the filter it does update the file list (black for items that match the filter, grey for items that don't match the selected filter):

    QString LCompFiles::LoadFileFilters(void) const
    {
    	QString				file_filters;
    	
    	file_filters = QStringLiteral("All Compensation Maps (*.bin *.res *.dat *.cmp *.asc *.enc *.prg *.cfg *.smp *.asc Y* *.map "\
    						"*.vo2 *.txt *.gec *.gecs *.3pg *.xdx *.ydy *.zdz *.ecd *.v3d *.nob)");
    	file_filters += QStringLiteral(";;Apogee Maps (*.res)");
    	file_filters += QStringLiteral(";;Automation Software Maps (*.dat)");
    	file_filters += QStringLiteral(";;Brown and Sharpe Maps (*.cmp *.asc *.dat *.enc)");
    	file_filters += QStringLiteral(";;Capps Maps (*.bin *.dat)");
    	file_filters += QStringLiteral(";;Chorus Maps (*.dat)");
    	file_filters += QStringLiteral(";;CMM Manager Maps (*.map *.txt)");
    	file_filters += QStringLiteral(";;DEA Maps (*.dat)");
    	file_filters += QStringLiteral(";;DEVA Maps (*.xdx *.ydy *.zdz *.txt *.nob)");
    	file_filters += QStringLiteral(";;Leitz Maps (*.txt)");
    	file_filters += QStringLiteral(";;LK Maps (*.prg)");
    	file_filters += QStringLiteral(";;Metrolog Maps (*.res)");
    	file_filters += QStringLiteral(";;OpenDMIS Maps (*.ecd)");
    	file_filters += QStringLiteral(";;Renishaw Compensation Maps (*.gec *.gecs *.3pg)");
    	file_filters += QStringLiteral(";;Sheffield Maps (*.cfg *.smp)");
    	file_filters += QStringLiteral(";;Verisurf Compensation Maps (*.v3d)");
    	file_filters += QStringLiteral(";;Virtual DMIS Maps (*.txt)");
    	file_filters += QStringLiteral(";;Wenzel Maps (*.vo2)");
    	file_filters += QStringLiteral(";;Zeiss Maps (*.dat Y*)");
    
    	return file_filters;
    }
    

    I also tried the filters with VirtualBox. It all looks good.



  • After further investigations, it turns out it's a bug of Mavericks itself !
    NSOpenPanel bug
    My bad, sorry.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.