Reputation: 476
Despite setting setStandardButtons(0); it doesn't close the msgBox.
QMessageBox msgBox;
msgBox.setText("My List");
msgBox.setStyleSheet("QDialog { border: 1px solid black;}");
msgBox.setStandardButtons(0);
QTimer::singleShot(5000, &msgBox, SLOT(close()));
msgBox.exec();
Upvotes: 3
Views: 2147
Reputation: 2268
Use accept instead of close.
msgBox.setStandardButtons(QMessageBox::NoButton);
QTimer::singleShot(5000, &msgBox, &QMessageBox::accept);
Upvotes: 6