aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>2023-02-07 12:17:59 +0200
committerJarkko Koivikko <jarkko.koivikko@code-q.fi>2023-02-24 07:58:07 +0200
commit10f4807ca3ebb6a2fb813877b2f54f68b2cc8325 (patch)
treef411a7ed1d9170abbbd6db52923343b1fce11d51
parent1078aba39f14808ab5a218e6af1a877600248198 (diff)
Fix InputPanel keyboardRectangle binding6.4
The word candidate view was previously accounted to InputPanel.Keyboard height based on visibility. This caused complex binding issues during animations. The word candidate view was also included into keyboardRectangle. This prevented the application from comparing it to the cursorRectangle in binding fullScreenMode on the result. With this change the word candidate list is not accounted to keyboard height anymore. Instead, the height is added to the InputPanel.height. Furthermore, the keyboardRectangle never includes the word candidate list. This allows the application to compare it to the cursorRectangle. Fixes: QTBUG-97830 Change-Id: I40de1bbc9a79da3e0a0cc1de70836bc8bd3289ff Reviewed-by: Inho Lee <inho.lee@qt.io> (cherry picked from commit 2bd67e9248d0a11d16fe4eec767e663c8e47939e)
-rw-r--r--examples/virtualkeyboard/basic/basic-b2qt.qml2
-rw-r--r--src/components/Keyboard.qml50
-rw-r--r--src/virtualkeyboard/InputPanel.qml18
-rw-r--r--tests/auto/inputpanel/BLACKLIST8
4 files changed, 38 insertions, 40 deletions
diff --git a/examples/virtualkeyboard/basic/basic-b2qt.qml b/examples/virtualkeyboard/basic/basic-b2qt.qml
index 72784655..ec34a471 100644
--- a/examples/virtualkeyboard/basic/basic-b2qt.qml
+++ b/examples/virtualkeyboard/basic/basic-b2qt.qml
@@ -86,8 +86,6 @@ Item {
x: 0
width: parent.width
- keyboard.shadowInputControl.height: parent.height - keyboard.height
-
property real yPositionWhenHidden: parent.height
states: State {
diff --git a/src/components/Keyboard.qml b/src/components/Keyboard.qml
index 636b7535..ad28ae8e 100644
--- a/src/components/Keyboard.qml
+++ b/src/components/Keyboard.qml
@@ -57,6 +57,7 @@ Item {
readonly property bool languagePopupListActive: languagePopupList.enabled
property alias soundEffect: soundEffect
property alias keyboardLayoutLoader: keyboardLayoutLoader
+ property real screenHeight: parent.parent ? parent.parent.height : Screen.height
function initDefaultInputMethod() {
try {
@@ -68,7 +69,7 @@ Item {
Component.onCompleted: InputContext.priv.registerInputPanel(parent)
width: keyboardBackground.width
- height: keyboardBackground.height + (VirtualKeyboardSettings.wordCandidateList.alwaysVisible ? wordCandidateView.height : 0)
+ height: keyboardBackground.height
onActiveChanged: {
hideLanguagePopup()
if (active && symbolMode && !preferNumbers)
@@ -91,10 +92,6 @@ Item {
if (!isValidLocale(localeIndex) || VirtualKeyboardSettings.locale)
localeIndex = defaultLocaleIndex
}
- function onFullScreenModeChanged() {
- wordCandidateView.disableAnimation = VirtualKeyboardSettings.fullScreenMode
- keyboard.fullScreenMode = VirtualKeyboardSettings.fullScreenMode
- }
function onDefaultInputMethodDisabledChanged() {
updateInputMethod()
}
@@ -653,8 +650,9 @@ Item {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: wordCandidateView.top
- height: (keyboard.parent.parent ? keyboard.parent.parent.height : Screen.height) -
- keyboard.height - (wordCandidateView.visibleCondition && !VirtualKeyboardSettings.wordCandidateList.alwaysVisible ? wordCandidateView.height : 0)
+ height: keyboard.screenHeight -
+ keyboard.height -
+ wordCandidateView.height
visible: fullScreenMode && (shadowInputControlVisibleTimer.running || InputContext.animating)
Connections {
@@ -693,13 +691,12 @@ Item {
objectName: "wordCandidateView"
clip: true
z: -2
- property bool disableAnimation: VirtualKeyboardSettings.fullScreenMode
property bool empty: true
- readonly property bool visibleCondition: (((!wordCandidateView.empty || wordCandidateViewAutoHideTimer.running || shadowInputControl.visible) &&
+ readonly property bool visibleCondition: (((!wordCandidateView.empty || wordCandidateViewAutoHideTimer.running) &&
InputContext.inputEngine.wordCandidateListVisibleHint) || VirtualKeyboardSettings.wordCandidateList.alwaysVisible) &&
- (keyboard.active || shadowInputControl.visible)
- readonly property real visibleYOffset: VirtualKeyboardSettings.wordCandidateList.alwaysVisible ? 0 : -height
- readonly property real currentYOffset: visibleCondition || wordCandidateViewTransition.running ? visibleYOffset : 0
+ keyboard.active
+ readonly property real visibleYOffset: -height
+ readonly property real currentYOffset: visibleCondition ? visibleYOffset : 0
height: style ? style.selectionListHeight : 0
anchors.left: parent.left
anchors.right: parent.right
@@ -750,18 +747,29 @@ Item {
id: defaultHighlight
Item {}
}
- states: State {
- name: "visible"
- when: wordCandidateView.visibleCondition
- PropertyChanges {
- target: wordCandidateView
- y: wordCandidateView.visibleYOffset
+ states: [
+ State {
+ name: "visible"
+ when: wordCandidateView.visibleCondition
+ PropertyChanges {
+ target: wordCandidateView
+ y: wordCandidateView.visibleYOffset
+ }
+ },
+ State {
+ name: "alwaysVisible"
+ when: keyboard.fullScreenMode || VirtualKeyboardSettings.wordCandidateList.alwaysVisible
+ PropertyChanges {
+ target: wordCandidateView
+ y: wordCandidateView.visibleYOffset
+ }
}
- }
+ ]
transitions: Transition {
id: wordCandidateViewTransition
+ from: ""
to: "visible"
- enabled: !InputContext.animating && !VirtualKeyboardSettings.wordCandidateList.alwaysVisible && !wordCandidateView.disableAnimation
+ enabled: !InputContext.animating
reversible: true
ParallelAnimation {
NumberAnimation {
@@ -1294,7 +1302,7 @@ Item {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
- height: keyboard.parent.parent ? keyboard.parent.parent.height : Screen.height
+ height: keyboard.screenHeight
onPressed: keyboard.hideWordCandidateContextMenu()
enabled: wordCandidateContextMenuList.enabled
}
diff --git a/src/virtualkeyboard/InputPanel.qml b/src/virtualkeyboard/InputPanel.qml
index 63f2bc5b..676cee67 100644
--- a/src/virtualkeyboard/InputPanel.qml
+++ b/src/virtualkeyboard/InputPanel.qml
@@ -96,6 +96,9 @@ Item {
/*! \internal */
property bool desktopPanel: false
+ /*! \internal */
+ property point screenPos: desktopPanel ? Qt.point(keyboard.x, keyboard.y) : Qt.point(x, y)
+
SelectionControl {
objectName: "selectionControl"
x: -parent.x
@@ -103,10 +106,9 @@ Item {
enabled: active && !keyboard.fullScreenMode && !desktopPanel
}
- implicitHeight: keyboard.height
+ implicitHeight: keyboard.height - keyboard.wordCandidateView.currentYOffset
Keyboard {
id: keyboard
- readonly property real yOffset: keyboard.wordCandidateView.currentYOffset - (keyboard.shadowInputControl.visible ? keyboard.shadowInputControl.height : 0)
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
@@ -127,15 +129,13 @@ Item {
/*! \internal */
function keyboardRectangle() {
- var rect = Qt.rect(0, keyboard.yOffset, keyboard.width, keyboard.height - keyboard.yOffset)
+ var rect = Qt.rect(0, 0, keyboard.width, keyboard.height)
+ const screenPosX = screenPos.x
+ const screenPosY = screenPos.y
if (desktopPanel) {
- rect.x += keyboard.x
- rect.y += keyboard.y
+ rect.x += screenPosX
+ rect.y += screenPosY
}
- // Read the inputPanel position.
- // This ensures that the Binding works.
- var unusedX = inputPanel.x
- var unusedY = inputPanel.y
return mapToItem(null, rect)
}
}
diff --git a/tests/auto/inputpanel/BLACKLIST b/tests/auto/inputpanel/BLACKLIST
index fd393e7a..ac88f44e 100644
--- a/tests/auto/inputpanel/BLACKLIST
+++ b/tests/auto/inputpanel/BLACKLIST
@@ -1,9 +1 @@
# See qtbase/src/testlib/qtestblacklist.cpp for format
-
-# QTBUG-97830
-[tst_plugin::test_fullScreenModeSelectionHandles:row 0]
-*
-[tst_plugin::test_fullScreenModeSelectionHandles:row 2]
-*
-[tst_plugin::test_fullScreenModeSelectionHandles:row 3]
-*