forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/5.0'
Conflicts: src/plugins/autotest/testresultdelegate.cpp Change-Id: If172206f231fc2a9f4a672cd2e6eaeaea4988c96
This commit is contained in:
@@ -144,8 +144,11 @@ QSize TestResultDelegate::sizeHint(const QStyleOptionViewItem &option, const QMo
|
||||
int fontHeight = fm.height();
|
||||
TestResultFilterModel *resultFilterModel = static_cast<TestResultFilterModel *>(view->model());
|
||||
LayoutPositions positions(opt, resultFilterModel);
|
||||
const int depth = resultFilterModel->itemForIndex(index)->level() + 1;
|
||||
const int indentation = depth * view->style()->pixelMetric(QStyle::PM_TreeViewIndentation, &opt);
|
||||
|
||||
QSize s;
|
||||
s.setWidth(opt.rect.width());
|
||||
s.setWidth(opt.rect.width() - indentation);
|
||||
|
||||
if (selected) {
|
||||
const TestResult *testResult = resultFilterModel->testResult(index);
|
||||
@@ -153,7 +156,7 @@ QSize TestResultDelegate::sizeHint(const QStyleOptionViewItem &option, const QMo
|
||||
QString output = testResult->outputString(selected);
|
||||
limitTextOutput(output);
|
||||
output.replace('\n', QChar::LineSeparator);
|
||||
recalculateTextLayout(index, output, opt.font, positions.textAreaWidth());
|
||||
recalculateTextLayout(index, output, opt.font, positions.textAreaWidth() - indentation);
|
||||
|
||||
s.setHeight(m_lastCalculatedHeight + 3);
|
||||
} else {
|
||||
@@ -174,9 +177,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::limitTextOutput(QString &output) const
|
||||
|
||||
@@ -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