forked from qt-creator/qt-creator
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:
@@ -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,
|
||||
|
@@ -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;
|
||||
|
@@ -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();
|
||||
|
Reference in New Issue
Block a user