diff options
author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2017-01-31 22:25:09 +0200 |
---|---|---|
committer | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2017-02-17 17:09:50 +0000 |
commit | b07f71a53f0dad132169e6d007b7305857400e99 (patch) | |
tree | 6a483eefb79b4f12b0653db56e488149e1765c29 /src/widgets/widgets | |
parent | 07745d7bfbf6c8d83e0243150d8ce934675dea87 (diff) |
Widgets: Update micro focus in QLineEdit and friends
QLineEdit, QAbstractSpinBox and QComboBox did not notify micro focus
changes to the input context.
In particular, the updates were missed during pre-edit stage.
This change adds the missing bindings to QWidget::updateMicroFocus().
Change-Id: I9a7fff962f46dbabd8fb02836c206bace115793b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r-- | src/widgets/widgets/qabstractspinbox.cpp | 4 | ||||
-rw-r--r-- | src/widgets/widgets/qcombobox.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qlineedit.h | 1 | ||||
-rw-r--r-- | src/widgets/widgets/qlineedit_p.cpp | 3 |
4 files changed, 10 insertions, 0 deletions
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index 6bcdc372ef..7ee53587e6 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -694,6 +694,10 @@ void QAbstractSpinBox::setLineEdit(QLineEdit *lineEdit) this, SLOT(_q_editorTextChanged(QString))); connect(d->edit, SIGNAL(cursorPositionChanged(int,int)), this, SLOT(_q_editorCursorPositionChanged(int,int))); + connect(d->edit, SIGNAL(cursorPositionChanged(int,int)), + this, SLOT(updateMicroFocus())); + connect(d->edit->d_func()->control, SIGNAL(updateMicroFocus()), + this, SLOT(updateMicroFocus())); } d->updateEditFieldGeometry(); d->edit->setContextMenuPolicy(Qt::NoContextMenu); diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 4519265fb8..f4e08dc670 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -65,6 +65,7 @@ #include <private/qcombobox_p.h> #include <private/qabstractitemmodel_p.h> #include <private/qabstractscrollarea_p.h> +#include <private/qlineedit_p.h> #include <qdebug.h> #if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && !defined(QT_NO_EFFECTS) && QT_CONFIG(style_mac) #include <private/qcore_mac_p.h> @@ -1790,6 +1791,7 @@ void QComboBox::setLineEdit(QLineEdit *edit) connect(d->lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(currentTextChanged(QString))); connect(d->lineEdit, SIGNAL(cursorPositionChanged(int,int)), this, SLOT(updateMicroFocus())); connect(d->lineEdit, SIGNAL(selectionChanged()), this, SLOT(updateMicroFocus())); + connect(d->lineEdit->d_func()->control, SIGNAL(updateMicroFocus()), this, SLOT(updateMicroFocus())); d->lineEdit->setFrame(false); d->lineEdit->setContextMenuPolicy(Qt::NoContextMenu); d->updateFocusPolicy(); diff --git a/src/widgets/widgets/qlineedit.h b/src/widgets/widgets/qlineedit.h index 1bdcfaf848..96dd64164f 100644 --- a/src/widgets/widgets/qlineedit.h +++ b/src/widgets/widgets/qlineedit.h @@ -239,6 +239,7 @@ public: private: friend class QAbstractSpinBox; friend class QAccessibleLineEdit; + friend class QComboBox; #ifdef QT_KEYPAD_NAVIGATION friend class QDateTimeEdit; #endif diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index 9947d63279..13f18f66d2 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -196,6 +196,9 @@ void QLineEditPrivate::init(const QString& txt) QObject::connect(control, SIGNAL(textChanged(QString)), q, SLOT(updateMicroFocus())); + QObject::connect(control, SIGNAL(updateMicroFocus()), + q, SLOT(updateMicroFocus())); + // for now, going completely overboard with updates. QObject::connect(control, SIGNAL(selectionChanged()), q, SLOT(update())); |