QFileDialog::DontUseNativeDialog is not working

前端 未结 2 1255
耶瑟儿~
耶瑟儿~ 2020-12-16 20:05

I have an issue with a simple program. I\'m opening a QFileDialog this way:

QFileDialog fileDialog(this);
fileDialog.setAcceptMode(QFileDialog::AcceptOpen);
         


        
2条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-16 20:48

    Are you sure that such a child is created? Because if so, I would have assumed that you could do something like

    QString path = QFileDialog::getExistingDirectory(this, ...);
    
    QFileDialog *filedialog = this->findChild();
    if (filedialog) {
        filedialog->deleteLater();
    }
    

    But I tried it creating the dialog with this as the parent and calling findChild in this object as well as creating the dialog using 0 as the parent and calling findChild in the main window; both to no avail.

提交回复
热议问题