簡體   English   中英

QDialog :: exec在3次調用后做出反應

[英]QDialog::exec react after 3 calls

我正在使用自定義對話框,並通過調用顯示它:

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;

但問題仍然懸而未決

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM