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>bb10
parent
20604ea554
commit
3ed91da499
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue