diff options
author | Christian Stenger <christian.stenger@qt.io> | 2021-08-18 09:13:57 +0200 |
---|---|---|
committer | Christian Stenger <christian.stenger@qt.io> | 2021-08-18 11:54:07 +0000 |
commit | 0d23a3b886e9ba669aa1fcb5f949300aeb704c85 (patch) | |
tree | 921e089073cad08b7a050e4afb0c82aa788b44b5 | |
parent | 017416e327d9a7eec86b3e2f4b6b94f975b64c86 (diff) |
AutoTest: Handle resizing appropriate
When the user resizes QC and has a test result selected which
contains multiple lines these lines will be re-evaluated
and may now end up in having more or less lines than before.
We need to inform the UI that this caused a change of the
needed size otherwise we end up in omitting lines or adding
empty lines.
Task-number: QTCREATORBUG-26122
Change-Id: I91b0271975f8f0fff128ef7cf6c74947c0162ea9
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r-- | src/plugins/autotest/testresultdelegate.cpp | 3 | ||||
-rw-r--r-- | src/plugins/autotest/testresultspane.cpp | 9 | ||||
-rw-r--r-- | src/plugins/autotest/testresultspane.h | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/autotest/testresultdelegate.cpp b/src/plugins/autotest/testresultdelegate.cpp index ebef913f18..34bd6188a8 100644 --- a/src/plugins/autotest/testresultdelegate.cpp +++ b/src/plugins/autotest/testresultdelegate.cpp @@ -183,9 +183,12 @@ void TestResultDelegate::currentChanged(const QModelIndex ¤t, const QModel void TestResultDelegate::clearCache() { + const QModelIndex current = m_lastProcessedIndex; m_lastProcessedIndex = QModelIndex(); m_lastProcessedFont = QFont(); m_lastWidth = -1; + if (current.isValid()) + emit sizeHintChanged(current); } void TestResultDelegate::recalculateTextLayout(const QModelIndex &index, const QString &output, diff --git a/src/plugins/autotest/testresultspane.cpp b/src/plugins/autotest/testresultspane.cpp index 4bbface7aa..d3b3691b76 100644 --- a/src/plugins/autotest/testresultspane.cpp +++ b/src/plugins/autotest/testresultspane.cpp @@ -166,6 +166,7 @@ TestResultsPane::TestResultsPane(QObject *parent) : this, &TestResultsPane::addTestResult); connect(TestRunner::instance(), &TestRunner::hadDisabledTests, m_model, &TestResultModel::raiseDisabledTests); + visualOutputWidget->installEventFilter(this); } void TestResultsPane::createToolButtons() @@ -576,6 +577,14 @@ void TestResultsPane::filterMenuTriggered(QAction *action) navigateStateChanged(); } +bool TestResultsPane::eventFilter(QObject *object, QEvent *event) +{ + QTC_ASSERT(m_outputWidget, return false); + if (event->type() == QEvent::Resize && object->parent() == m_outputWidget) + static_cast<TestResultDelegate *>(m_treeView->itemDelegate())->clearCache(); + return false; +} + void TestResultsPane::onTestRunStarted() { m_testRunning = true; diff --git a/src/plugins/autotest/testresultspane.h b/src/plugins/autotest/testresultspane.h index b13796b5a9..f28f1865f1 100644 --- a/src/plugins/autotest/testresultspane.h +++ b/src/plugins/autotest/testresultspane.h @@ -105,6 +105,7 @@ private: void onRunSelectedTriggered(); void checkAllFilter(bool checked); void filterMenuTriggered(QAction *action); + bool eventFilter(QObject *object, QEvent *event) override; void initializeFilterMenu(); void updateSummaryLabel(); |