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 Change-Id: I233e2bfd28836ae5578aadfe9332193848ac5a7f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> (cherry picked from commit 877b29a78e38ff7c6af2d63d93e6a554544bf278) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
5c4a0a5b26
commit
71cba1359e
@ -1772,9 +1772,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