QMessageBox without Button
-
Hi @all,
I used a QMessageBox but it add a button OK defaultQMessageBox msgBox; msgBox.setText("Updating Orb List..."); msgBox.setStyleSheet("QDialog { border: 1px solid black;}"); QTimer::singleShot(15000, &msgBox, SLOT(close())); msgBox.exec();
I used this setStandardButtons(0); but it stuck. doesn't close a msgBox
QMessageBox msgBox; msgBox.setText("Updating Orb List..."); msgBox.setStyleSheet("QDialog { border: 1px solid black;}"); msgBox.setStandardButtons(0); QTimer::singleShot(15000, &msgBox, SLOT(close())); msgBox.exec();
Any Ideas?
Thanks,
Nadim -
Use
accept
instead ofclose
. Also it's better to use predefined constants instead of magic numbers.msgBox.setStandardButtons(QMessageBox::NoButton); QTimer::singleShot(15000, &msgBox, &QMessageBox::accept);
-
Thanks @Chris-Kawa. It Works as expect.