Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

Show a messagebox until a thread emits a Signal

$
0
0
Hello, if I loose a connection to device I want to open a message box which says that the application waits for the connection to be reestablished. Therefore, when i recognize the lost connection i start a thread which will run until the connection is established again. Then it emits a Signal which says that the connection is established. This signal is connected to a slot of my gui thread, but unfortunately it does not close the messagebox, cause the thread is stuck in showing the messagebox. Is there a proper way to do this? Here is a snippet of my code QMessageBox* m_box;  //private class variable of gui thread   public void on_ConnectionLost() {   m_box = new QMessageBox();   m_box->setText("Wait for connection to return");   m_box->show(); }   public void on_ConnectionEstablished() {   if (m_box != nullptr) {     m_box->close();     delete m_box;     m_box = nullptr;   }   //restart processing } Thank you! Regards

Viewing all articles
Browse latest Browse all 13965

Trending Articles