diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2017-12-23 13:31:25 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2018-01-06 05:17:13 +0000 |
commit | 3ed91da4997cf793742e5bba2adb3dbec9ecd458 (patch) | |
tree | c7321c4a93ea607c6cea81974c8199b0198d0067 /src/widgets | |
parent | 20604ea554b282efa80502c68a499824f8692e7a (diff) |
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 <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/itemviews/qstyleditemdelegate.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
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); |