Combobox: Fix initial set of inputMethodHints
Fix for setting up initial inputMethodHints to Qt::ImhNoPredictiveText for Combobox. Before this change, Qt::ImhNoPredictiveText was never set for Combobox. As inputMethodHints() by default returns Qt::ImhNoPredictiveText value, setInputMethodHints didn't allow to set this value correctly. Task-number: QTBUG-61021 Pick-to: 5.15 6.0 Change-Id: Ie4ec0d32fff7586bc3a8bd055b752000c0330fad Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
parent
80039621c0
commit
b87cada5e3
|
@ -269,6 +269,8 @@ public:
|
||||||
void itemImplicitWidthChanged(QQuickItem *item) override;
|
void itemImplicitWidthChanged(QQuickItem *item) override;
|
||||||
void itemImplicitHeightChanged(QQuickItem *item) override;
|
void itemImplicitHeightChanged(QQuickItem *item) override;
|
||||||
|
|
||||||
|
void setInputMethodHints(Qt::InputMethodHints hints, bool force = false);
|
||||||
|
|
||||||
virtual qreal getContentWidth() const override;
|
virtual qreal getContentWidth() const override;
|
||||||
qreal calculateWidestTextWidth() const;
|
qreal calculateWidestTextWidth() const;
|
||||||
void maybeUpdateImplicitContentWidth();
|
void maybeUpdateImplicitContentWidth();
|
||||||
|
@ -791,6 +793,16 @@ void QQuickComboBoxPrivate::itemImplicitWidthChanged(QQuickItem *item)
|
||||||
emit q->implicitIndicatorWidthChanged();
|
emit q->implicitIndicatorWidthChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QQuickComboBoxPrivate::setInputMethodHints(Qt::InputMethodHints hints, bool force)
|
||||||
|
{
|
||||||
|
Q_Q(QQuickComboBox);
|
||||||
|
if (!force && hints == q->inputMethodHints())
|
||||||
|
return;
|
||||||
|
|
||||||
|
extra.value().inputMethodHints = hints;
|
||||||
|
emit q->inputMethodHintsChanged();
|
||||||
|
}
|
||||||
|
|
||||||
void QQuickComboBoxPrivate::itemImplicitHeightChanged(QQuickItem *item)
|
void QQuickComboBoxPrivate::itemImplicitHeightChanged(QQuickItem *item)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickComboBox);
|
Q_Q(QQuickComboBox);
|
||||||
|
@ -893,7 +905,8 @@ QQuickComboBox::QQuickComboBox(QQuickItem *parent)
|
||||||
#if QT_CONFIG(cursor)
|
#if QT_CONFIG(cursor)
|
||||||
setCursor(Qt::ArrowCursor);
|
setCursor(Qt::ArrowCursor);
|
||||||
#endif
|
#endif
|
||||||
setInputMethodHints(Qt::ImhNoPredictiveText);
|
Q_D(QQuickComboBox);
|
||||||
|
d->setInputMethodHints(Qt::ImhNoPredictiveText, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
QQuickComboBox::~QQuickComboBox()
|
QQuickComboBox::~QQuickComboBox()
|
||||||
|
@ -1529,11 +1542,7 @@ Qt::InputMethodHints QQuickComboBox::inputMethodHints() const
|
||||||
void QQuickComboBox::setInputMethodHints(Qt::InputMethodHints hints)
|
void QQuickComboBox::setInputMethodHints(Qt::InputMethodHints hints)
|
||||||
{
|
{
|
||||||
Q_D(QQuickComboBox);
|
Q_D(QQuickComboBox);
|
||||||
if (hints == inputMethodHints())
|
d->setInputMethodHints(hints);
|
||||||
return;
|
|
||||||
|
|
||||||
d->extra.value().inputMethodHints = hints;
|
|
||||||
emit inputMethodHintsChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -157,6 +157,7 @@ TestCase {
|
||||||
verify(control.delegate)
|
verify(control.delegate)
|
||||||
verify(control.indicator)
|
verify(control.indicator)
|
||||||
verify(control.popup)
|
verify(control.popup)
|
||||||
|
compare(control.inputMethodHints, Qt.ImhNoPredictiveText)
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_array() {
|
function test_array() {
|
||||||
|
|
Loading…
Reference in New Issue