remove internal use of SE_ViewItemCheckIndicator
This is marked to be removed in Qt6, so switch to SE_ItemViewItemCheckIndicator internally and define the old value as copy of the new one instead of the other way round. Change-Id: I9e9804a7ff0e9b2ae1e24698d45b2cbd44423420 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
parent
441ac7084c
commit
b3f9b2f148
@ -1089,7 +1089,7 @@ QRect QItemDelegate::doCheck(const QStyleOptionViewItem &option,
|
||||
opt.rect = bounding;
|
||||
const QWidget *widget = d->widget(option); // cast
|
||||
QStyle *style = widget ? widget->style() : QApplication::style();
|
||||
return style->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt, widget);
|
||||
return style->subElementRect(QStyle::SE_ItemViewItemCheckIndicator, &opt, widget);
|
||||
}
|
||||
return QRect();
|
||||
}
|
||||
|
@ -3067,7 +3067,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
|
||||
}
|
||||
d->cachedOption = new QStyleOptionViewItem(*vopt);
|
||||
}
|
||||
if (sr == SE_ViewItemCheckIndicator)
|
||||
if (sr == SE_ItemViewItemCheckIndicator)
|
||||
r = d->checkRect;
|
||||
else if (sr == SE_ItemViewItemDecoration)
|
||||
r = d->decorationRect;
|
||||
|
@ -308,8 +308,8 @@ public:
|
||||
SE_TabWidgetLeftCorner,
|
||||
SE_TabWidgetRightCorner,
|
||||
|
||||
SE_ViewItemCheckIndicator, // ### Qt 6: remove
|
||||
SE_ItemViewItemCheckIndicator = SE_ViewItemCheckIndicator,
|
||||
SE_ItemViewItemCheckIndicator,
|
||||
SE_ViewItemCheckIndicator = SE_ItemViewItemCheckIndicator, // ### Qt 6: remove
|
||||
|
||||
SE_TabBarTearIndicator,
|
||||
SE_TabBarTearIndicatorLeft = SE_TabBarTearIndicator,
|
||||
|
@ -5825,7 +5825,7 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c
|
||||
return ParentStyle::subElementRect(se, opt, w);
|
||||
|
||||
#if QT_CONFIG(itemviews)
|
||||
case SE_ViewItemCheckIndicator:
|
||||
case SE_ItemViewItemCheckIndicator:
|
||||
if (!qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
|
||||
return subElementRect(SE_CheckBoxIndicator, opt, w);
|
||||
}
|
||||
|
@ -1215,7 +1215,7 @@ void tst_QItemDelegate::editorEvent()
|
||||
option.checkState = Qt::CheckState(checkState);
|
||||
|
||||
const int checkMargin = qApp->style()->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, 0) + 1;
|
||||
QPoint pos = inCheck ? qApp->style()->subElementRect(QStyle::SE_ViewItemCheckIndicator, &option, 0).center() + QPoint(checkMargin, 0) : QPoint(200,200);
|
||||
QPoint pos = inCheck ? qApp->style()->subElementRect(QStyle::SE_ItemViewItemCheckIndicator, &option, 0).center() + QPoint(checkMargin, 0) : QPoint(200,200);
|
||||
|
||||
QEvent *event = new QMouseEvent((QEvent::Type)type,
|
||||
pos,
|
||||
@ -1371,7 +1371,7 @@ void tst_QItemDelegate::QTBUG4435_keepSelectionOnCheck()
|
||||
option.features = QStyleOptionViewItem::HasDisplay | QStyleOptionViewItem::HasCheckIndicator;
|
||||
option.checkState = Qt::CheckState(model.index(0, 0).data(Qt::CheckStateRole).toInt());
|
||||
const int checkMargin = qApp->style()->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, 0) + 1;
|
||||
QPoint pos = qApp->style()->subElementRect(QStyle::SE_ViewItemCheckIndicator, &option, 0).center()
|
||||
QPoint pos = qApp->style()->subElementRect(QStyle::SE_ItemViewItemCheckIndicator, &option, 0).center()
|
||||
+ QPoint(checkMargin, 0);
|
||||
QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ControlModifier, pos);
|
||||
QTRY_VERIFY(view.selectionModel()->isColumnSelected(0, QModelIndex()));
|
||||
|
@ -3004,7 +3004,7 @@ void tst_QTreeWidget::task191552_rtl()
|
||||
opt.features = QStyleOptionViewItem::HasDisplay | QStyleOptionViewItem::HasCheckIndicator;
|
||||
opt.checkState = Qt::Checked;
|
||||
opt.widget = &tw;
|
||||
const QRect checkRect = tw.style()->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt, &tw);
|
||||
const QRect checkRect = tw.style()->subElementRect(QStyle::SE_ItemViewItemCheckIndicator, &opt, &tw);
|
||||
QTest::mouseClick(tw.viewport(), Qt::LeftButton, Qt::NoModifier, checkRect.center());
|
||||
QCOMPARE(item->checkState(0), Qt::Unchecked);
|
||||
|
||||
@ -3218,7 +3218,7 @@ void tst_QTreeWidget::nonEditableTristate()
|
||||
option.checkState = item->checkState(0);
|
||||
|
||||
const int checkMargin = qApp->style()->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, 0) + 1;
|
||||
QPoint pos = qApp->style()->subElementRect(QStyle::SE_ViewItemCheckIndicator, &option, 0).center() + QPoint(checkMargin, 0);
|
||||
QPoint pos = qApp->style()->subElementRect(QStyle::SE_ItemViewItemCheckIndicator, &option, 0).center() + QPoint(checkMargin, 0);
|
||||
QTest::mouseClick(tree->viewport(), Qt::LeftButton, Qt::NoModifier, pos);
|
||||
QCOMPARE(int(item->checkState(0)), int(Qt::Checked));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user