forked from qt-creator/qt-creator
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 <david.schulz@qt.io>
This commit is contained in:
@@ -181,6 +181,12 @@ void TestResultDelegate::currentChanged(const QModelIndex ¤t, const QModel
|
|||||||
emit sizeHintChanged(previous);
|
emit sizeHintChanged(previous);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestResultDelegate::clearCache()
|
||||||
|
{
|
||||||
|
m_lastProcessedIndex = QModelIndex();
|
||||||
|
m_lastProcessedFont = QFont();
|
||||||
|
}
|
||||||
|
|
||||||
void TestResultDelegate::recalculateTextLayout(const QModelIndex &index, const QString &output,
|
void TestResultDelegate::recalculateTextLayout(const QModelIndex &index, const QString &output,
|
||||||
const QFont &font, int width) const
|
const QFont &font, int width) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public:
|
|||||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||||
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
||||||
|
void clearCache();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void recalculateTextLayout(const QModelIndex &index, const QString &output,
|
void recalculateTextLayout(const QModelIndex &index, const QString &output,
|
||||||
|
|||||||
@@ -275,6 +275,8 @@ int TestResultsPane::priorityInStatusBar() const
|
|||||||
void TestResultsPane::clearContents()
|
void TestResultsPane::clearContents()
|
||||||
{
|
{
|
||||||
m_filterModel->clearTestResults();
|
m_filterModel->clearTestResults();
|
||||||
|
if (auto delegate = qobject_cast<TestResultDelegate *>(m_treeView->itemDelegate()))
|
||||||
|
delegate->clearCache();
|
||||||
setIconBadgeNumber(0);
|
setIconBadgeNumber(0);
|
||||||
navigateStateChanged();
|
navigateStateChanged();
|
||||||
m_summaryWidget->setVisible(false);
|
m_summaryWidget->setVisible(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user