简体   繁体   English

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

[英]QDialog::exec react after 3 calls

I'm using a custom dialog, and I'm showing it by calling: 我正在使用自定义对话框,并通过调用显示它:

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

All this code is invoked in void MainWindow::on_boardView_clicked(const QModelIndex &index){} (event "clicked" from QTableView ). 所有这些代码都在void MainWindow::on_boardView_clicked(const QModelIndex &index){}调用(事件从QTableView “单击”)。

The problem is quite strange. 这个问题很奇怪。 I need to click on my button for 3 times for dialog to show. 我需要单击3次按钮才能显示对话框。 After second click Qt Creator gives me warning like this "QDialog::exec: Recursive call detected" . 第二次单击后,Qt Creator给我这样的警告"QDialog::exec: Recursive call detected"

Funny thing is that this happens only once (in single application instance). 有趣的是,这仅发生一次(在单个应用程序实例中)。 Next clicks works like a charm. 下次点击就像是一种魅力。

I haven't fixed this problem, but i made a little workaround and it works like that: 我尚未解决此问题,但我做了一些解决方法,它的工作原理如下:

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

But the question is still opened 但问题仍然悬而未决

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM