QDialog::exec在3次调用后做出反应

QDialog::exec react after 3 calls

本文关键字:调用 exec 3次 QDialog      更新时间:2023-10-16

我正在使用一个自定义对话框,我通过调用:

来显示它
this->numberPick.move(point);
this->numberPick.setWindowFlags(Qt::SplashScreen);
this->numberPick.setParent(this);
this->numberPick.setModal(true);
this->numberPick.exec();

void MainWindow::on_boardView_clicked(const QModelIndex &index){}中调用所有这些代码(从QTableView中单击事件)。

这个问题很奇怪。我需要点击我的按钮3次对话框显示。第二次点击Qt Creator给我警告像这样的"QDialog::exec: Recursive call detected"

有趣的是,这种情况只发生一次(在单个应用程序实例中)。

我还没有解决这个问题,但我做了一个小的解决方案,它的工作原理是这样的:

this->numberPick = new NumberPick(this);
this->numberPick->setCell(cell);
this->numberPick->move(point);
this->numberPick->setWindowFlags(Qt::SplashScreen);
this->numberPick->exec();
delete this->numberPick;

但问题仍未解决