Kubuntu 22.04 - Open File Dialog box file filter is blank
-
This code is in C++.
It is for Linux.
I am on Kubuntu 20.04 and 22.04.When I create an Open File Dialog box, setting up the file filter is important.
On Kubuntu 20.04, also Kubuntu 18.04, also, Linux Mint and Ubuntu, the code was working fine.
On Kubuntu 22.04, I can’t seem to set the file filter selection programmaticly.QString selectedFilter; char pSaveFilePath[some size]; QFileDialog *aDlg; selectedFilter="TXT - Text file (*.txt)"; fileFilter="TXT - Text file (*.txt);;RTF - Rich text file (*.rtf);;DOC - document file (*.doc)"; aDlg=new QFileDialog(this, "Save As", pSaveFilePath, fileFilter); aDlg->setFilter(QDir::AllEntries); aDlg->selectNameFilter(selectedFilter); aDlg->setAcceptMode(QFileDialog::AcceptMode::AcceptSave); returnVal=aDlg->exec(); if(returnVal==QDialog::Accepted) { Stuff.... }
The magic happens with
aDlg->selectNameFilter(selectedFilter);Qt is suppose to take the text in “selectedFilter“ and setup the COMBOBOX for the file filter.
On Kubuntu 22.04, it seems to not make a selection at all and leaves the COMBOBOX empty.
The list is not empty. I can drop the list and make a selection.
But aDlg->selectNameFilter() should programmaticly set it to an initial condition.Is my selectedFilter bad?
Is my fileFilter bad?