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. Kubuntu 22.04 - Open File Dialog box file filter is blank
Forum Updated to NodeBB v4.3 + New Features

Kubuntu 22.04 - Open File Dialog box file filter is blank

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 161 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.
  • S Offline
    S Offline
    stretchthebits
    wrote on last edited by
    #1

    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?

    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