Hide button on error message box.

This commit is contained in:
Gerhard Hoffmann 2023-08-11 11:07:16 +02:00
parent c338884fc7
commit a932ed5471

View File

@ -170,21 +170,20 @@ void MainWindow::onReplaceLast(QString text, QString suffix) {
} }
} }
for (int i=0; i<lines.size(); ++i) { Utils::printLineEditInfo(lines);
qInfo() << lines.at(i);
} qInfo() << ""; qInfo() << "";
ui->updateStatus->setText(lines.join('\n').trimmed()); ui->updateStatus->setText(lines.join('\n').trimmed());
ui->updateStatus->setEnabled(true); ui->updateStatus->setEnabled(true);
} }
void MainWindow::onShowErrorMessage(QString title, QString text) { void MainWindow::onShowErrorMessage(QString title, QString text) {
text = text.leftJustified(50, ' '); text = text.leftJustified(50, ' ');
QMessageBox msgBox(QMessageBox::NoIcon, title, QMessageBox msgBox(QMessageBox::NoIcon, title,
text, QMessageBox::Ok, text, QMessageBox::Ok,
nullptr, Qt::FramelessWindowHint); nullptr, Qt::FramelessWindowHint);
msgBox.setDefaultButton(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.setStyleSheet("QDialog {background-color: red;}" msgBox.defaultButton()->setVisible(false);
"QPushButton {background-color: blue;}");
QTimer *t = new QTimer(this); QTimer *t = new QTimer(this);
connect(t, SIGNAL(timeout()), msgBox.defaultButton(), SLOT(click())); connect(t, SIGNAL(timeout()), msgBox.defaultButton(), SLOT(click()));
t->setSingleShot(true); t->setSingleShot(true);
@ -195,5 +194,4 @@ void MainWindow::onShowErrorMessage(QString title, QString text) {
} else { } else {
// do something else // do something else
} }
disconnect(t, SIGNAL(timeout()), msgBox.defaultButton(), SLOT(click()));
} }