summaryrefslogtreecommitdiffstats
path: root/src/settingsui/main.qml
diff options
context:
space:
mode:
authorKimmo Ollila <kimmo.ollila@theqtcompany.com>2016-03-11 12:09:26 +0200
committerKimmo Ollila <kimmo.ollila@theqtcompany.com>2016-03-16 13:45:02 +0000
commit0aab56ca5eea0ba4df48258f1a1c866d21bb9bce (patch)
tree22c6ec0121a70403efe114c13408637609ccede4 /src/settingsui/main.qml
parentd873745b783ed6a9c582055058ed8a1f1506bf20 (diff)
Migrate VirtualKeyboard 2.0 to settings UI.
Change-Id: I0be16db0d2bcc8ef3408916e1f708e270f4a9f8b Reviewed-by: Teemu Holappa <teemu.holappa@theqtcompany.com>
Diffstat (limited to 'src/settingsui/main.qml')
-rw-r--r--src/settingsui/main.qml84
1 files changed, 81 insertions, 3 deletions
diff --git a/src/settingsui/main.qml b/src/settingsui/main.qml
index 9129ff5..1ed1138 100644
--- a/src/settingsui/main.qml
+++ b/src/settingsui/main.qml
@@ -33,6 +33,9 @@ import Qt.labs.controls.material 1.0
import Qt.labs.controls.universal 1.0
import Qt.labs.settings 1.0
import QtQuick.XmlListModel 2.0
+import QtQuick.Enterprise.VirtualKeyboard 2.0
+import com.theqtcompany.localdevice 1.0
+import "common"
ApplicationWindow {
id: root
@@ -82,17 +85,16 @@ ApplicationWindow {
MenuItem {
text: qsTr("Reboot")
- onTriggered: B2QtDevice.reboot()
+ onTriggered: LocalDevice.reboot()
}
MenuItem {
text: qsTr("Shutdown")
- onTriggered: B2QtDevice.powerOff()
+ onTriggered: LocalDevice.powerOff()
}
}
}
}
}
-
StackView {
id: stackView
initialItem: mainView
@@ -101,6 +103,8 @@ ApplicationWindow {
anchors.left: parent.left
anchors.right: parent.right
+ Behavior on anchors.topMargin { NumberAnimation { duration: 250; easing.type: Easing.InOutQuad }}
+
Component {
id: mainView
@@ -160,4 +164,78 @@ ApplicationWindow {
}
}
}
+
+ property var inputItem: InputContext.inputItem
+
+ HandwritingInputPanel {
+
+ id: handwritingInputPanel
+ anchors.fill: parent
+ inputPanel: inputPanel
+
+ Rectangle {
+ z: -1
+ anchors.fill: parent
+ color: "black"
+ opacity: 0.10
+ }
+
+ onAvailableChanged: {
+ if (!available)
+ inputPanel.ensureVisible()
+ }
+ }
+ Item {
+ visible: handwritingInputPanel.enabled && Qt.inputMethod.visible
+ anchors { left: parent.left; top: parent.top; right: parent.right; bottom: inputPanel.top; }
+
+ HandwritingModeButton {
+ id: handwritingModeButton
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.margins: 10
+ floating: true
+ flipable: true
+ width: 76
+ height: width
+ state: handwritingInputPanel.state
+ onClicked: handwritingInputPanel.active = !handwritingInputPanel.active
+ onDoubleClicked: handwritingInputPanel.available = !handwritingInputPanel.available
+ }
+ }
+ InputPanel {
+ id: inputPanel
+ y: active ? parent.height - inputPanel.height : parent.height
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ Behavior on y { NumberAnimation {duration: 250; easing.type: Easing.InOutQuad}}
+
+ property var inputItem: InputContext.inputItem
+
+ onInputItemChanged: {
+ if (handwritingInputPanel.available)
+ return;
+
+ if (inputItem) {
+ ensureVisible()
+ }
+ }
+
+ onActiveChanged: {
+ if (!active) {
+ stackView.anchors.topMargin = 0
+
+ if (!handwritingInputPanel.available && inputItem)
+ inputItem.focus = false
+ }
+ }
+
+ function ensureVisible() {
+ var mapped = inputItem.mapToItem(handwritingInputPanel, 0,0)
+ if (mapped.y > (handwritingInputPanel.height-inputPanel.height-40)) {
+ stackView.anchors.topMargin = -inputPanel.height
+ }
+ }
+ }
}