c++qtdeploymentqcomboboxqdialog

QComboBox doesn't display the currently selected item unless another button in the dialog is clicked


I have this QDialog:

enter image description here

The QComboBox won't display the currently selected item unless any other button inside the dialog was clicked.

Important thing to note is, that this only happens in the deployment. When I run the project in Qt it works just fine. Is there a DLL interfering with the QComboBox? I don't know where to look for.

The deployments directory:

enter image description here

If it helps, this is how I fill the QComboBox:

  void settings_box::fill_dropdown()
  {
    QStringList list;
    if(!avail_adapters.empty())
    {
        for(const auto &adapter : avail_adapters)
        {
            list << QString::fromStdString(adapter.first);
        }
    }
    ui->dropdown->addItems(list);
  }

I designed the QDialog and its widgets with the designer in QtCreator (Qt 5.15.0 for UWP 64bit (MSVC 2015))

Have you encountered this one yourself? Is there a possible solution you can provide me with?

Thanks in advance!

EDIT: I'm quite pleased with the workaround I found, but if you REALLY want to solve this I be here for you.


Solution

  • I found this workaround that does the same what needs to happen for it to appear, when you use the app.

    This code gives focus to the checked radio button when the dialog appears.

    void settings_box::showEvent(QShowEvent *event){
        //makes the event happen
        event->accept();
    
        //which radio button is checked
        if(ui->maximizedRadio->isChecked()){
            //updates the dropdown showing its selected item
            emit ui->maximizedRadio->setFocus();
        } else{
            //updates the dropdown showing its selected item
            emit ui->fullscreenRadio->setFocus();
        }
    }
    

    Note that this is just a workaround, I still don't know why this issue exists at all.