Skip to content

Commit

Permalink
+ truncate text when too long in message box in unit test panel and s…
Browse files Browse the repository at this point in the history
…how the full text in detailed section
  • Loading branch information
wwmayer committed Oct 17, 2015
1 parent b6c2f8f commit 4208b08
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/Mod/Test/Gui/UnitTestImp.cpp
Expand Up @@ -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();
}

/**
Expand Down

0 comments on commit 4208b08

Please sign in to comment.