diff options
author | Liang Qi <liang.qi@qt.io> | 2016-11-25 16:06:52 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-11-25 16:06:52 +0100 |
commit | e67e97e9543eae2de42666eec3ff4d3cdca81db3 (patch) | |
tree | dabfba5605c8aa99ad2b548f0ad95b02d4569cac | |
parent | 1ba0613309439f778b4b4e955131d80936490371 (diff) | |
parent | ea873857fd7c92608bfa64d080dbdf9589ffa4b3 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
src/virtualkeyboard/content/InputPanel.qml
Change-Id: I6839198e123f682a88132f8efbed0bdaf8835e7e
-rw-r--r-- | src/virtualkeyboard/content/InputPanel.qml | 6 | ||||
-rw-r--r-- | src/virtualkeyboard/shifthandler.cpp | 8 | ||||
-rw-r--r-- | tests/auto/inputpanel/data/inputpanel/inputpanel.qml | 7 | ||||
-rw-r--r-- | tests/auto/inputpanel/data/tst_inputpanel.qml | 21 |
4 files changed, 37 insertions, 5 deletions
diff --git a/src/virtualkeyboard/content/InputPanel.qml b/src/virtualkeyboard/content/InputPanel.qml index 1ac2eb86..2e500a1b 100644 --- a/src/virtualkeyboard/content/InputPanel.qml +++ b/src/virtualkeyboard/content/InputPanel.qml @@ -46,11 +46,13 @@ import QtQuick.VirtualKeyboard 2.1 Item { id: inputPanel - /*! \qmlproperty bool Active state of the input panel + /*! + \qmlproperty bool InputPanel::active \since QtQuick.VirtualKeyboard 2.0 This property reflects the active status of the input panel. - The keyboard should be made visible to user when the active is true. + The keyboard should be made visible to the user when this property is + \c true. */ property alias active: keyboard.active diff --git a/src/virtualkeyboard/shifthandler.cpp b/src/virtualkeyboard/shifthandler.cpp index 4c9f498b..d6252fa9 100644 --- a/src/virtualkeyboard/shifthandler.cpp +++ b/src/virtualkeyboard/shifthandler.cpp @@ -201,10 +201,13 @@ void ShiftHandler::reset() autoCapitalizationEnabled = false; toggleShiftEnabled = false; } - d->inputContext->setShift(preferUpperCase); - d->inputContext->setCapsLock(preferUpperCase); setToggleShiftEnabled(toggleShiftEnabled); setAutoCapitalizationEnabled(autoCapitalizationEnabled); + d->inputContext->setCapsLock(preferUpperCase); + if (preferUpperCase) + d->inputContext->setShift(preferUpperCase); + else + autoCapitalize(); } } @@ -237,7 +240,6 @@ void ShiftHandler::autoCapitalize() void ShiftHandler::restart() { reset(); - autoCapitalize(); } void ShiftHandler::shiftChanged() diff --git a/tests/auto/inputpanel/data/inputpanel/inputpanel.qml b/tests/auto/inputpanel/data/inputpanel/inputpanel.qml index 5a7dfc11..4d42d941 100644 --- a/tests/auto/inputpanel/data/inputpanel/inputpanel.qml +++ b/tests/auto/inputpanel/data/inputpanel/inputpanel.qml @@ -83,6 +83,7 @@ InputPanel { property alias soundEffectSpy: soundEffectSpy property alias inputMethodResultSpy: inputMethodResultSpy property alias wordCandidateListChangedSpy: wordCandidateListChangedSpy + property alias shiftStateSpy: shiftStateSpy signal inputMethodResult(var text) @@ -162,6 +163,12 @@ InputPanel { signalName: "dataChanged" } + SignalSpy { + id: shiftStateSpy + target: InputContext + signalName: "onShiftChanged" + } + function findChildByProperty(parent, propertyName, propertyValue, compareCb) { var obj = null if (parent === null) diff --git a/tests/auto/inputpanel/data/tst_inputpanel.qml b/tests/auto/inputpanel/data/tst_inputpanel.qml index 335f23e5..915d7441 100644 --- a/tests/auto/inputpanel/data/tst_inputpanel.qml +++ b/tests/auto/inputpanel/data/tst_inputpanel.qml @@ -384,6 +384,27 @@ Rectangle { compare(textInput.text, data.outputText) } + function test_focusAndShiftState() { + prepareTest() + + // Initial focus is set to textInput, shift state should not change + // when focus is set to container + inputPanel.shiftStateSpy.clear() + container.forceActiveFocus() + compare(inputPanel.shiftStateSpy.count, 0, "Unexpected number of shift state changes after focus change (ImhNone -> ImhNone)") + + // Change to lower case + inputPanel.shiftStateSpy.clear() + inputPanel.toggleShift() + compare(inputPanel.shiftStateSpy.count, 1, "Unexpected number of shift state changes after shift key press") + + // Set focus back to textInput, and expect that shift state is changed + // to auto upper case + inputPanel.shiftStateSpy.clear() + textInput.forceActiveFocus() + compare(inputPanel.shiftStateSpy.count, 1, "Unexpected number of shift state changes after focus change (auto upper case)") + } + function test_symbolMode() { prepareTest({ initInputMethodHints: Qt.ImhNoPredictiveText }) |