From 4208b0840d1b7a7396f238475bd2059fc27ef828 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 17 Oct 2015 14:33:54 +0200 Subject: [PATCH] + truncate text when too long in message box in unit test panel and show the full text in detailed section --- src/Mod/Test/Gui/UnitTestImp.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Mod/Test/Gui/UnitTestImp.cpp b/src/Mod/Test/Gui/UnitTestImp.cpp index baae6d015..331f9d74f 100644 --- a/src/Mod/Test/Gui/UnitTestImp.cpp +++ b/src/Mod/Test/Gui/UnitTestImp.cpp @@ -117,7 +117,22 @@ void UnitTestDialog::setProgressColor(const QColor& col) */ void UnitTestDialog::on_treeViewFailure_itemDoubleClicked(QTreeWidgetItem * item, int column) { - QMessageBox::information(this, item->text(0), item->data(0, Qt::UserRole).toString()); + QString text = item->data(0, Qt::UserRole).toString(); + + QMessageBox msgBox(this); + msgBox.setIcon(QMessageBox::Information); + msgBox.setWindowTitle(item->text(0)); + msgBox.setDetailedText(text); + + // truncate the visible text when it's too long + if (text.count(QLatin1Char('\n')) > 20) { + QStringList lines = text.split(QLatin1Char('\n')); + lines.erase(lines.begin()+20, lines.end()); + text = lines.join(QLatin1String("\n")); + } + + msgBox.setText(text); + msgBox.exec(); } /**