I have a QFileDialog in Qt for saving a file.
It is not smmiting signals. I connect it via QFileDialog diag(this); ...
connect(
dialog, SIGNAL(filterSelected(const QString&)),
this, SLOT(saveAsDiagFilterSelected(const QString&)),
Qt::QueuedConnection);
Then call it with exec()
. The saveAsDiagFilterSelected
is never called.
What might be wrong?
This is how I create my dialog:
dialog = new QFileDialog(this);
dialog->setFileMode(QFileDialog::AnyFile);
dialog->setNameFilters(filterList);
dialog->setAcceptMode(QFileDialog::AcceptSave);
dialog->setWindowTitle(windowTitle);
I tried implementing the new signal API (as suggested in comments):
connect(
dialog, &QFileDialog::filterSelected,
this, &MainWindow::saveAsDiagFilterSelected);
but still no results.
Update
Found out that using the OS native dialog (I'm under Linux, dont know if this happens in other SO's), is creating the problem. If I do
dialog->setOption(QFileDialog::DontUseNativeDialog, true);
the signal is emmited. How can I workaround this?