下面的一段代码在2秒后关闭我的QMessageBox
。但是我的文字显示了盒子关闭时的情况,它在盒子关闭之前非常快速地闪烁。这里发生了什么?关闭定时器上的QMessageBox,setText不显示
QMessageBox *msgBox = new QMessageBox();
msgBox->setText("Coördinate is being created, please wait...");
msgBox->show();
QTimer::singleShot(2000, msgBox, SLOT(hide()));
这说明,然后就关闭之前,我可以看到的文字。
更新
在单线程程序工作:方法WriteMultipleACLCommands()
占用了大量的时间。也许这是问题?
QMessageBox *msgBox = new QMessageBox();
msgBox->setText("Coördinate is being created, please wait...");
msgBox->show();
QTimer::singleShot(2000, msgBox, SLOT(hide()));
singleton_SerialPortManager->WriteMultipleACLCommands();
//function writes a few bytes onto a serial connection
我试过了你的代码,我没有看到闪烁的东西。我在Ubuntu 14.04上使用Qt 5.5.1。 – agold
它看起来不像代码有任何问题。这更可能是其他地方的东西。 –