From 3ed91da4997cf793742e5bba2adb3dbec9ecd458 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 23 Dec 2017 13:31:25 +0100 Subject: QStyledItemDelegate: adjust editor geometry also in LTR-mode The editor geometry was adjusted to a proper size in RTL-mode, but not in LTR-mode. To fix this inconsistency, the geometry is now also adjusted in LTR-mode to make sure the editor has enough space for the min/max values for the given datatype. Task-number: QTBUG-37433 Change-Id: Iff41e854f2fa2104ab5c589d24780facc3ed5815 Reviewed-by: Richard Moe Gustavsen --- src/widgets/itemviews/qstyleditemdelegate.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp index 716df2c729..43b640fd69 100644 --- a/src/widgets/itemviews/qstyleditemdelegate.cpp +++ b/src/widgets/itemviews/qstyleditemdelegate.cpp @@ -514,12 +514,13 @@ void QStyledItemDelegate::updateEditorGeometry(QWidget *editor, QStyle *style = widget ? widget->style() : QApplication::style(); QRect geom = style->subElementRect(QStyle::SE_ItemViewItemText, &opt, widget); - if ( editor->layoutDirection() == Qt::RightToLeft) { - const int delta = qSmartMinSize(editor).width() - geom.width(); - if (delta > 0) { - //we need to widen the geometry + const int delta = qSmartMinSize(editor).width() - geom.width(); + if (delta > 0) { + //we need to widen the geometry + if (editor->layoutDirection() == Qt::RightToLeft) geom.adjust(-delta, 0, 0, 0); - } + else + geom.adjust(0, 0, delta, 0); } editor->setGeometry(geom); -- cgit v1.2.3