From 970fca0d353f5c6d05c763bf7bdd12aac6f5ea0b Mon Sep 17 00:00:00 2001 From: Soeren Apel Date: Thu, 27 Dec 2018 21:22:15 +0100 Subject: [PATCH] Don't use QMessageBox::setInformativeText() When using it, the extended error message text is not reliably appended to the dialog text. --- pv/dialogs/settings.cpp | 6 ++---- pv/dialogs/storeprogress.cpp | 3 +-- pv/mainwindow.cpp | 3 +-- pv/toolbars/mainbar.cpp | 3 +-- pv/views/trace/decodetrace.cpp | 3 +-- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/pv/dialogs/settings.cpp b/pv/dialogs/settings.cpp index 2bbab12..780a666 100644 --- a/pv/dialogs/settings.cpp +++ b/pv/dialogs/settings.cpp @@ -744,8 +744,7 @@ void Settings::on_log_saveToFile_clicked(bool checked) if (out_stream.status() == QTextStream::Ok) { QMessageBox msg(this); - msg.setText(tr("Success")); - msg.setInformativeText(tr("Log saved to %1.").arg(file_name)); + msg.setText(tr("Success") + "\n\n" + tr("Log saved to %1.").arg(file_name)); msg.setStandardButtons(QMessageBox::Ok); msg.setIcon(QMessageBox::Information); msg.exec(); @@ -755,8 +754,7 @@ void Settings::on_log_saveToFile_clicked(bool checked) } QMessageBox msg(this); - msg.setText(tr("Error")); - msg.setInformativeText(tr("File %1 could not be written to.").arg(file_name)); + msg.setText(tr("Error") + "\n\n" + tr("File %1 could not be written to.").arg(file_name)); msg.setStandardButtons(QMessageBox::Ok); msg.setIcon(QMessageBox::Warning); msg.exec(); diff --git a/pv/dialogs/storeprogress.cpp b/pv/dialogs/storeprogress.cpp index 9f4279c..2bca347 100644 --- a/pv/dialogs/storeprogress.cpp +++ b/pv/dialogs/storeprogress.cpp @@ -82,8 +82,7 @@ void StoreProgress::show_error() qDebug() << "Error trying to save:" << session_.error(); QMessageBox msg(parentWidget()); - msg.setText(tr("Failed to save session.")); - msg.setInformativeText(session_.error()); + msg.setText(tr("Failed to save session.") + "\n\n" + session_.error()); msg.setStandardButtons(QMessageBox::Ok); msg.setIcon(QMessageBox::Warning); msg.exec(); diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index fd889e9..960c389 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -95,8 +95,7 @@ void MainWindow::show_session_error(const QString text, const QString info_text) qDebug() << "Notifying user of session error:" << info_text; QMessageBox msg; - msg.setText(text); - msg.setInformativeText(info_text); + msg.setText(text + "\n\n" + info_text); msg.setStandardButtons(QMessageBox::Ok); msg.setIcon(QMessageBox::Warning); msg.exec(); diff --git a/pv/toolbars/mainbar.cpp b/pv/toolbars/mainbar.cpp index e6beb2b..df1363d 100644 --- a/pv/toolbars/mainbar.cpp +++ b/pv/toolbars/mainbar.cpp @@ -556,8 +556,7 @@ void MainBar::commit_sample_count() void MainBar::show_session_error(const QString text, const QString info_text) { QMessageBox msg(this); - msg.setText(text); - msg.setInformativeText(info_text); + msg.setText(text + "\n\n" + info_text); msg.setStandardButtons(QMessageBox::Ok); msg.setIcon(QMessageBox::Warning); msg.exec(); diff --git a/pv/views/trace/decodetrace.cpp b/pv/views/trace/decodetrace.cpp index 9c7196b..65a2bf6 100644 --- a/pv/views/trace/decodetrace.cpp +++ b/pv/views/trace/decodetrace.cpp @@ -1036,8 +1036,7 @@ void DecodeTrace::export_annotations(vector *annotations) const } QMessageBox msg(owner_->view()); - msg.setText(tr("Error")); - msg.setInformativeText(tr("File %1 could not be written to.").arg(file_name)); + msg.setText(tr("Error") + "\n\n" + tr("File %1 could not be written to.").arg(file_name)); msg.setStandardButtons(QMessageBox::Ok); msg.setIcon(QMessageBox::Warning); msg.exec(); -- 2.30.2