diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2018-10-18 22:45:09 +0200 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2018-11-05 21:58:37 +0000 |
commit | e9bebc12812b5c50346952cd9128bdd08ddd0b9d (patch) | |
tree | 034ec85715e682b73594b67bb32ea57875b81b8e /tests | |
parent | f06e0f62fafcb0eeb725122b2a5321363d417663 (diff) |
Fix use of deprecated ItemDataRoles Background/TextColorRole
Replace BackgroundColorRole/TextColorRole with
BackgroundRole/ForegroundRole and explicit deprecate them for 5.13
Change-Id: I6b0d99844a32d2f5fdfd1878317a7b7422b800d3
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests')
6 files changed, 10 insertions, 16 deletions
diff --git a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp index 6ea7a38137..dbc7173028 100644 --- a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp +++ b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp @@ -251,7 +251,7 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) QString val = xval + QString::number(y) + QString::number(i); QModelIndex index = model->index(x, y, parent); model->setData(index, val); - model->setData(index, blue, Qt::TextColorRole); + model->setData(index, blue, Qt::ForegroundRole); } } */ @@ -276,7 +276,7 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) QString val = xval + QString::number(y) + QString::number(i); QModelIndex index = realModel->index(x, y, parent); realModel->setData(index, val); - realModel->setData(index, blue, Qt::TextColorRole); + realModel->setData(index, blue, Qt::ForegroundRole); } } */ diff --git a/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp b/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp index 7cd220e684..da13b9f33f 100644 --- a/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp +++ b/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp @@ -576,12 +576,12 @@ void tst_QItemModel::data() alignment == Qt::AlignJustify); } - QVariant colorVariant = currentModel->data(currentModel->index(0,0), Qt::BackgroundColorRole); + QVariant colorVariant = currentModel->data(currentModel->index(0,0), Qt::BackgroundRole); if (colorVariant.isValid()) { QVERIFY(colorVariant.canConvert<QColor>()); } - colorVariant = currentModel->data(currentModel->index(0,0), Qt::TextColorRole); + colorVariant = currentModel->data(currentModel->index(0,0), Qt::ForegroundRole); if (colorVariant.isValid()) { QVERIFY(colorVariant.canConvert<QColor>()); } diff --git a/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp b/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp index d19aa9b54f..2deb84fa5f 100644 --- a/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp +++ b/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp @@ -202,9 +202,7 @@ void tst_QStandardItem::getSetData() QCOMPARE(qvariant_cast<QSize>(item.data(Qt::SizeHintRole)), sizeHint); QCOMPARE(qvariant_cast<QFont>(item.data(Qt::FontRole)), font); QCOMPARE(qvariant_cast<int>(item.data(Qt::TextAlignmentRole)), int(textAlignment)); - QCOMPARE(qvariant_cast<QBrush>(item.data(Qt::BackgroundColorRole)), QBrush(backgroundColor)); QCOMPARE(qvariant_cast<QBrush>(item.data(Qt::BackgroundRole)), QBrush(backgroundColor)); - QCOMPARE(qvariant_cast<QBrush>(item.data(Qt::TextColorRole)), QBrush(textColor)); QCOMPARE(qvariant_cast<QBrush>(item.data(Qt::ForegroundRole)), QBrush(textColor)); QCOMPARE(qvariant_cast<int>(item.data(Qt::CheckStateRole)), int(checkState)); QCOMPARE(qvariant_cast<QString>(item.data(Qt::AccessibleTextRole)), accessibleText); @@ -236,9 +234,7 @@ void tst_QStandardItem::getSetData() QCOMPARE(item.data(Qt::SizeHintRole), QVariant()); QCOMPARE(item.data(Qt::FontRole), QVariant()); QCOMPARE(item.data(Qt::TextAlignmentRole), QVariant()); - QCOMPARE(item.data(Qt::BackgroundColorRole), QVariant()); QCOMPARE(item.data(Qt::BackgroundRole), QVariant()); - QCOMPARE(item.data(Qt::TextColorRole), QVariant()); QCOMPARE(item.data(Qt::ForegroundRole), QVariant()); QCOMPARE(item.data(Qt::CheckStateRole), QVariant()); QCOMPARE(item.data(Qt::AccessibleTextRole), QVariant()); diff --git a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp index e2d7a41bd1..550f70890e 100644 --- a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp +++ b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp @@ -1160,7 +1160,7 @@ void tst_QStandardItemModel::getSetItemData() QColor backgroundColor(Qt::blue); roles.insert(Qt::BackgroundRole, backgroundColor); QColor textColor(Qt::green); - roles.insert(Qt::TextColorRole, textColor); + roles.insert(Qt::ForegroundRole, textColor); Qt::CheckState checkState(Qt::PartiallyChecked); roles.insert(Qt::CheckStateRole, int(checkState)); QLatin1String accessibleText("accessibleText"); diff --git a/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp b/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp index bbdaac5c6f..071665a5e3 100644 --- a/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp +++ b/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp @@ -249,7 +249,7 @@ void tst_QItemView::populate() for (int y = 0; y < treeModel->columnCount(); ++y) { QModelIndex index = treeModel->index(x, y, parent); treeModel->setData(index, xS + QLatin1Char('_') + QString::number(y) + QLatin1Char('_') + iS); - treeModel->setData(index, QVariant(QColor(Qt::blue)), Qt::TextColorRole); + treeModel->setData(index, QVariant(QColor(Qt::blue)), Qt::ForegroundRole); } } } diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp index c5ccbc0d0b..e0a9684d13 100644 --- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp @@ -1885,9 +1885,8 @@ void tst_QTreeWidget::setData() QCOMPARE(qvariant_cast<QSize>(item->data(j, Qt::SizeHintRole)), sizeHint); QCOMPARE(qvariant_cast<QFont>(item->data(j, Qt::FontRole)), font); QCOMPARE(qvariant_cast<int>(item->data(j, Qt::TextAlignmentRole)), int(textAlignment)); - QCOMPARE(qvariant_cast<QBrush>(item->data(j, Qt::BackgroundColorRole)), QBrush(backgroundColor)); QCOMPARE(qvariant_cast<QBrush>(item->data(j, Qt::BackgroundRole)), QBrush(backgroundColor)); - QCOMPARE(qvariant_cast<QColor>(item->data(j, Qt::TextColorRole)), textColor); + QCOMPARE(qvariant_cast<QColor>(item->data(j, Qt::ForegroundRole)), textColor); QCOMPARE(qvariant_cast<int>(item->data(j, Qt::CheckStateRole)), int(checkState)); item->setBackground(j, pixmap); @@ -1907,8 +1906,8 @@ void tst_QTreeWidget::setData() item->setData(j, Qt::SizeHintRole, QVariant()); item->setData(j, Qt::FontRole, QVariant()); item->setData(j, Qt::TextAlignmentRole, QVariant()); - item->setData(j, Qt::BackgroundColorRole, QVariant()); - item->setData(j, Qt::TextColorRole, QVariant()); + item->setData(j, Qt::BackgroundRole, QVariant()); + item->setData(j, Qt::ForegroundRole, QVariant()); item->setData(j, Qt::CheckStateRole, QVariant()); QCOMPARE(itemChangedSpy.count(), 11); itemChangedSpy.clear(); @@ -1921,9 +1920,8 @@ void tst_QTreeWidget::setData() QCOMPARE(item->data(j, Qt::SizeHintRole), QVariant()); QCOMPARE(item->data(j, Qt::FontRole), QVariant()); QCOMPARE(item->data(j, Qt::TextAlignmentRole), QVariant()); - QCOMPARE(item->data(j, Qt::BackgroundColorRole), QVariant()); QCOMPARE(item->data(j, Qt::BackgroundRole), QVariant()); - QCOMPARE(item->data(j, Qt::TextColorRole), QVariant()); + QCOMPARE(item->data(j, Qt::ForegroundRole), QVariant()); QCOMPARE(item->data(j, Qt::CheckStateRole), QVariant()); } } |