简体   繁体   中英

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 ).

The problem is quite strange. I need to click on my button for 3 times for dialog to show. After second click Qt Creator gives me warning like this "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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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