QWindows11Style: Add checkbox offset to ItemViewItemText
Add the width of a checkbox to the starting starting x position of the ItemViewItemText in case the ItemViewItem has a checkbox. Fixes: PYSIDE-2897 Fixes: PYSIDE-2906 Pick-to: 6.8 Change-Id: I233e2bfd28836ae5578aadfe9332193848ac5a7f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
parent
67850200da
commit
877b29a78e
@ -1784,9 +1784,13 @@ QRect QWindows11Style::subElementRect(QStyle::SubElement element, const QStyleOp
|
||||
case QStyle::SE_ItemViewItemText:
|
||||
if (const auto *item = qstyleoption_cast<const QStyleOptionViewItem *>(option)) {
|
||||
const int decorationOffset = item->features.testFlag(QStyleOptionViewItem::HasDecoration) ? item->decorationSize.width() : 0;
|
||||
const int checkboxOffset = item->features.testFlag(QStyleOptionViewItem::HasCheckIndicator) ? 16 : 0;
|
||||
if (widget && widget->parentWidget()
|
||||
&& widget->parentWidget()->inherits("QComboBoxPrivateContainer")) {
|
||||
ret = option->rect.adjusted(decorationOffset + 5, 0, -5, 0);
|
||||
if (option->direction == Qt::LeftToRight)
|
||||
ret = option->rect.adjusted(decorationOffset + checkboxOffset + 5, 0, -5, 0);
|
||||
else
|
||||
ret = option->rect.adjusted(5, 0, decorationOffset - checkboxOffset - 5, 0);
|
||||
} else {
|
||||
ret = QWindowsVistaStyle::subElementRect(element, option, widget);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user