diff options
author | BogDan Vatra <bogdan@kdab.com> | 2016-03-04 12:48:03 +0200 |
---|---|---|
committer | BogDan Vatra <bogdan@kdab.com> | 2016-03-04 10:55:51 +0000 |
commit | 340879d8263f9383d33ed4eb3271b00e54c13f47 (patch) | |
tree | 61ff2bde5737613b560824f95cbe1534f69cbf92 | |
parent | a414a327cd0d0d832fb9b041aa4de3e5990106de (diff) |
Add increase/decrease methods to combobox control.
It is useful in envs (e.g. Android TV) where Up/Down are used to select prev/next controls
not to inc/dec the values of the control.
Change-Id: I1b55dafccd4af83b0bfe65b572bd9e643a073625
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
-rw-r--r-- | src/templates/qquickcombobox.cpp | 22 | ||||
-rw-r--r-- | src/templates/qquickcombobox_p.h | 3 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/templates/qquickcombobox.cpp b/src/templates/qquickcombobox.cpp index 31703536..75492924 100644 --- a/src/templates/qquickcombobox.cpp +++ b/src/templates/qquickcombobox.cpp @@ -705,6 +705,28 @@ int QQuickComboBox::find(const QString &text, Qt::MatchFlags flags) const return -1; } +/*! + \qmlmethod void Qt.labs.controls::ComboBox::increase() + + Select next value. +*/ +void QQuickComboBox::increase() +{ + Q_D(QQuickComboBox); + d->increase(); +} + +/*! + \qmlmethod void Qt.labs.controls::ComboBox::decrease() + + Select previous value. +*/ +void QQuickComboBox::decrease() +{ + Q_D(QQuickComboBox); + d->decrease(); +} + void QQuickComboBox::focusOutEvent(QFocusEvent *event) { Q_D(QQuickComboBox); diff --git a/src/templates/qquickcombobox_p.h b/src/templates/qquickcombobox_p.h index 42fc962b..23def3c8 100644 --- a/src/templates/qquickcombobox_p.h +++ b/src/templates/qquickcombobox_p.h @@ -106,6 +106,9 @@ public: Q_INVOKABLE QString textAt(int index) const; Q_INVOKABLE int find(const QString &text, Qt::MatchFlags flags = Qt::MatchExactly) const; +public Q_SLOTS: + void increase(); + void decrease(); Q_SIGNALS: void countChanged(); |