From 017416e327d9a7eec86b3e2f4b6b94f975b64c86 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 17 Aug 2021 16:55:26 +0200 Subject: [PATCH] AutoTest: Take indentation of sub items into account Otherwise we might end up losing final lines depending on the output and the need of wrapping the text. Fixes: QTCREATORBUG-26122 Change-Id: I724bacfa8be37a056f56a67fce4b724d367fda4a Reviewed-by: David Schulz Reviewed-by: Christian Stenger --- src/plugins/autotest/testresultdelegate.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/autotest/testresultdelegate.cpp b/src/plugins/autotest/testresultdelegate.cpp index f0e7ec111c0..ebef913f183 100644 --- a/src/plugins/autotest/testresultdelegate.cpp +++ b/src/plugins/autotest/testresultdelegate.cpp @@ -147,8 +147,11 @@ QSize TestResultDelegate::sizeHint(const QStyleOptionViewItem &option, const QMo int fontHeight = fm.height(); TestResultFilterModel *resultFilterModel = static_cast(view->model()); LayoutPositions positions(opt, resultFilterModel); + const int depth = resultFilterModel->itemForIndex(index)->level() + 1; + const int indentation = depth * view->style()->pixelMetric(QStyle::PM_TreeViewIndentation, &opt); + QSize s; - s.setWidth(opt.rect.width()); + s.setWidth(opt.rect.width() - indentation); if (selected) { const TestResult *testResult = resultFilterModel->testResult(index); @@ -159,7 +162,7 @@ QSize TestResultDelegate::sizeHint(const QStyleOptionViewItem &option, const QMo if (AutotestPlugin::settings()->limitResultOutput && output.length() > outputLimit) output = output.left(outputLimit).append("..."); - recalculateTextLayout(index, output, opt.font, positions.textAreaWidth()); + recalculateTextLayout(index, output, opt.font, positions.textAreaWidth() - indentation); s.setHeight(m_lastCalculatedHeight + 3); } else {