forked from qt-creator/qt-creator
AutoTest: Remove usages of deprecated QModelIndex::child
Change-Id: I8b310a54d6c1a044c94edac8fd67dfa8b2fcfb91 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
bcb2df7b30
commit
12e253df9d
@@ -430,7 +430,7 @@ bool TestResultFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &s
|
|||||||
bool TestResultFilterModel::acceptTestCaseResult(const QModelIndex &srcIndex) const
|
bool TestResultFilterModel::acceptTestCaseResult(const QModelIndex &srcIndex) const
|
||||||
{
|
{
|
||||||
for (int row = 0, count = m_sourceModel->rowCount(srcIndex); row < count; ++row) {
|
for (int row = 0, count = m_sourceModel->rowCount(srcIndex); row < count; ++row) {
|
||||||
const QModelIndex &child = srcIndex.child(row, 0);
|
const QModelIndex &child = m_sourceModel->index(row, 0, srcIndex);
|
||||||
Result::Type type = m_sourceModel->testResult(child)->result();
|
Result::Type type = m_sourceModel->testResult(child)->result();
|
||||||
if (type == Result::MessageTestCaseSuccess)
|
if (type == Result::MessageTestCaseSuccess)
|
||||||
type = Result::Pass;
|
type = Result::Pass;
|
||||||
|
|||||||
@@ -324,7 +324,7 @@ void TestResultsPane::goToNext()
|
|||||||
if (currentIndex.isValid()) {
|
if (currentIndex.isValid()) {
|
||||||
// try to set next to first child or next sibling
|
// try to set next to first child or next sibling
|
||||||
if (m_filterModel->rowCount(currentIndex)) {
|
if (m_filterModel->rowCount(currentIndex)) {
|
||||||
nextCurrentIndex = currentIndex.child(0, 0);
|
nextCurrentIndex = m_filterModel->index(0, 0, currentIndex);
|
||||||
} else {
|
} else {
|
||||||
nextCurrentIndex = currentIndex.sibling(currentIndex.row() + 1, 0);
|
nextCurrentIndex = currentIndex.sibling(currentIndex.row() + 1, 0);
|
||||||
// if it had no sibling check siblings of parent (and grandparents if necessary)
|
// if it had no sibling check siblings of parent (and grandparents if necessary)
|
||||||
@@ -369,7 +369,7 @@ void TestResultsPane::goToPrev()
|
|||||||
nextCurrentIndex = currentIndex.sibling(currentIndex.row() - 1, 0);
|
nextCurrentIndex = currentIndex.sibling(currentIndex.row() - 1, 0);
|
||||||
// if the sibling has children, use the last one
|
// if the sibling has children, use the last one
|
||||||
while (int rowCount = m_filterModel->rowCount(nextCurrentIndex))
|
while (int rowCount = m_filterModel->rowCount(nextCurrentIndex))
|
||||||
nextCurrentIndex = nextCurrentIndex.child(rowCount - 1, 0);
|
nextCurrentIndex = m_filterModel->index(rowCount - 1, 0, nextCurrentIndex);
|
||||||
} else {
|
} else {
|
||||||
nextCurrentIndex = currentIndex.parent();
|
nextCurrentIndex = currentIndex.parent();
|
||||||
}
|
}
|
||||||
@@ -386,7 +386,7 @@ void TestResultsPane::goToPrev()
|
|||||||
nextCurrentIndex = m_filterModel->index(m_filterModel->rowCount(QModelIndex()) - 1, 0);
|
nextCurrentIndex = m_filterModel->index(m_filterModel->rowCount(QModelIndex()) - 1, 0);
|
||||||
// step through until end
|
// step through until end
|
||||||
while (int rowCount = m_filterModel->rowCount(nextCurrentIndex))
|
while (int rowCount = m_filterModel->rowCount(nextCurrentIndex))
|
||||||
nextCurrentIndex = nextCurrentIndex.child(rowCount - 1, 0);
|
nextCurrentIndex = m_filterModel->index(rowCount - 1, 0, nextCurrentIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_treeView->setCurrentIndex(nextCurrentIndex);
|
m_treeView->setCurrentIndex(nextCurrentIndex);
|
||||||
|
|||||||
Reference in New Issue
Block a user