Commit 96da2973 authored by Christian Stenger's avatar Christian Stenger

AutoTest: Clear cached information before running

We cache the last processed model index as well as the used
font. In some cases the cached information interfered with
new information and ended up in an ugly painting issue
where old information partially got repainted instead of
using the new. Clear cached information when starting a new
run to avoid this.

Change-Id: Ibb01e5e3bdd7b542325b5867d37c677d31a14aae
Reviewed-by: David Schulz's avatarDavid Schulz <david.schulz@qt.io>
parent 72c167be
......@@ -181,6 +181,12 @@ void TestResultDelegate::currentChanged(const QModelIndex &current, const QModel
emit sizeHintChanged(previous);
}
void TestResultDelegate::clearCache()
{
m_lastProcessedIndex = QModelIndex();
m_lastProcessedFont = QFont();
}
void TestResultDelegate::recalculateTextLayout(const QModelIndex &index, const QString &output,
const QFont &font, int width) const
{
......
......@@ -42,6 +42,7 @@ public:
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
void currentChanged(const QModelIndex &current, const QModelIndex &previous);
void clearCache();
private:
void recalculateTextLayout(const QModelIndex &index, const QString &output,
......
......@@ -275,6 +275,8 @@ int TestResultsPane::priorityInStatusBar() const
void TestResultsPane::clearContents()
{
m_filterModel->clearTestResults();
if (auto delegate = qobject_cast<TestResultDelegate *>(m_treeView->itemDelegate()))
delegate->clearCache();
setIconBadgeNumber(0);
navigateStateChanged();
m_summaryWidget->setVisible(false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment