QFileDialog crashes/hangs in Windows 11

149 Views Asked by At

I am trying to read a folder name, but when opening QFileDialog it hangs or crashes and app stops. I have tried several options and configurations.

I have tried different options such as DontuseNativeDialog and others. The funny thing is that this code was working in a dev environment under Windows 10.

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QFileDialog>

MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QString folderName = QFileDialog::getExistingDirectory(this, tr("Open Directory"),"C:\\",QFileDialog::ShowDirsOnly);
}

MainWindow::~MainWindow()
{
    delete ui;
}
0

There are 0 best solutions below