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>
This commit is contained in:
Christian Stenger
2021-08-18 09:13:57 +02:00
parent 017416e327
commit 0d23a3b886
3 changed files with 13 additions and 0 deletions

View File

@@ -183,9 +183,12 @@ void TestResultDelegate::currentChanged(const QModelIndex &current, 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,

View File

@@ -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;

View File

@@ -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();