aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>2015-10-12 13:52:37 +0300
committerJarkko Koivikko <jarkko.koivikko@code-q.fi>2015-10-28 10:20:09 +0000
commit4693f6b37bf655883bcb86fa65a1f67bcb394f40 (patch)
tree021be60937797f3cb49f118879709e8ffed8cc48 /examples
parenta7c373d8f23c03d93b0ef92774163d1913f3e053 (diff)
Fix binding loop in the HandwritingModeButton
The binding loop occurs when resizing the example app compiled with disable-desktop CONFIG flag, e.g.: <Unknown File>: QML Drag: Binding loop detected for property "maximumY" Also, do not dynamically resize the button as the rest of the example application is fixed size too. Change-Id: I6f409947bd7c7697da394b61d7f732dd1dba4e49 Reviewed-by: Rainer Keller <rainer.keller@theqtcompany.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/quick/enterprise/virtualkeyboard/virtualkeyboard/VirtualKeyboard-b2qt.qml2
-rw-r--r--examples/quick/enterprise/virtualkeyboard/virtualkeyboard/content/HandwritingModeButton.qml26
2 files changed, 17 insertions, 11 deletions
diff --git a/examples/quick/enterprise/virtualkeyboard/virtualkeyboard/VirtualKeyboard-b2qt.qml b/examples/quick/enterprise/virtualkeyboard/virtualkeyboard/VirtualKeyboard-b2qt.qml
index 0a469e30..cdb18b97 100644
--- a/examples/quick/enterprise/virtualkeyboard/virtualkeyboard/VirtualKeyboard-b2qt.qml
+++ b/examples/quick/enterprise/virtualkeyboard/virtualkeyboard/VirtualKeyboard-b2qt.qml
@@ -81,7 +81,7 @@ Item {
anchors.margins: 10
floating: true
flipable: true
- width: handwritingInputPanel.height / 588 * 76
+ width: 76
height: width
state: handwritingInputPanel.state
onClicked: handwritingInputPanel.active = !handwritingInputPanel.active
diff --git a/examples/quick/enterprise/virtualkeyboard/virtualkeyboard/content/HandwritingModeButton.qml b/examples/quick/enterprise/virtualkeyboard/virtualkeyboard/content/HandwritingModeButton.qml
index cfa77c9c..c135729b 100644
--- a/examples/quick/enterprise/virtualkeyboard/virtualkeyboard/content/HandwritingModeButton.qml
+++ b/examples/quick/enterprise/virtualkeyboard/virtualkeyboard/content/HandwritingModeButton.qml
@@ -86,22 +86,28 @@ Item {
function snapHorizontal() {
if (!floating)
return
- if (mouseArea.drag.maximumX > 0 && anchors.left !== parent.left && anchors.right !== parent.right) {
- if (x + 20 >= mouseArea.drag.maximumX)
+ if (mouseArea.drag.maximumX > mouseArea.drag.minimumX) {
+ if (x + 20 >= mouseArea.drag.maximumX) {
+ anchors.left = undefined
anchors.right = parent.right
- else if (x - 20 <= mouseArea.drag.minimumX)
+ } else if (x - 20 <= mouseArea.drag.minimumX) {
+ anchors.right = undefined
anchors.left = parent.left
+ }
}
}
function snapVertical() {
if (!floating)
return
- if (mouseArea.drag.maximumY > 0 && anchors.bottom !== parent.bottom && anchors.top !== parent.top) {
- if (y + 20 >= mouseArea.drag.maximumY)
+ if (mouseArea.drag.maximumY > mouseArea.drag.minimumY) {
+ if (y + 20 >= mouseArea.drag.maximumY) {
+ anchors.top = undefined
anchors.bottom = parent.bottom
- else if (y - 20 <= mouseArea.drag.minimumY)
+ } else if (y - 20 <= mouseArea.drag.minimumY) {
+ anchors.bottom = undefined
anchors.top = parent.top
+ }
}
}
@@ -112,11 +118,11 @@ Item {
target: handwritingModeButton.floating ? handwritingModeButton : undefined
axis: Drag.XAxis | Drag.YAxis
minimumX: 0
- maximumX: Math.max(handwritingModeButton.parent.width - handwritingModeButton.width, 0)
- onMaximumXChanged: handwritingModeButton.snapHorizontal()
+ maximumX: handwritingModeButton.parent.width - handwritingModeButton.width
+ onMaximumXChanged: !mouseArea.drag.active && handwritingModeButton.snapHorizontal()
minimumY: 0
- maximumY: Math.max(handwritingModeButton.parent.height - handwritingModeButton.height, 0)
- onMaximumYChanged: handwritingModeButton.snapVertical()
+ maximumY: handwritingModeButton.parent.height - handwritingModeButton.height
+ onMaximumYChanged: !mouseArea.drag.active && handwritingModeButton.snapVertical()
}
onPressed: {
if (!handwritingModeButton.floating)