aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/manual/x11vkbwrapper/Keyboard.qml (renamed from tests/manual/x11vkbwrapper/keyboard.qml)34
-rw-r--r--tests/manual/x11vkbwrapper/main.cpp16
-rw-r--r--tests/manual/x11vkbwrapper/main.qml13
-rw-r--r--tests/manual/x11vkbwrapper/qml.qrc2
-rw-r--r--tests/manual/x11vkbwrapper/x11vkbwrapper.pro2
5 files changed, 32 insertions, 35 deletions
diff --git a/tests/manual/x11vkbwrapper/keyboard.qml b/tests/manual/x11vkbwrapper/Keyboard.qml
index 02d93769..f58e1dca 100644
--- a/tests/manual/x11vkbwrapper/keyboard.qml
+++ b/tests/manual/x11vkbwrapper/Keyboard.qml
@@ -27,14 +27,15 @@
**
****************************************************************************/
-import QtQuick 2.9
+import QtQuick 2.12
import QtQuick.Window 2.2
import QtQuick.VirtualKeyboard 2.2
Window {
id: keyboardWindow
- width: Screen.width / scaleFactor
- height: inputPanel.height + d.alternativeKeySpaceHeight
+ width: Screen.width / 2
+ height: width / 3.2
+ y: Screen.height - height
color: "transparent"
visible: Qt.inputMethod.visible
flags: Qt.WindowStaysOnTopHint | Qt.WindowDoesNotAcceptFocus | Qt.FramelessWindowHint
@@ -42,11 +43,6 @@ Window {
readonly property double scaleFactor: 1.5
signal languageChangedSignal(string msg)
- QtObject {
- id: d
- property double alternativeKeySpaceHeight: inputPanel.height / 4.5
- }
-
Loader {
id: testLoader
sourceComponent: {
@@ -71,7 +67,25 @@ Window {
InputPanel {
id: inputPanel
z: 99
- width: keyboardWindow.width
- anchors.bottom: parent.bottom
+ anchors.fill: parent
+
+ DragHandler {
+ target: null
+ onTranslationChanged: {
+ var dx = translation.x
+ var dy = translation.y
+ if (keyboardWindow.x < 0)
+ dx = 0
+ if (keyboardWindow.x + keyboardWindow.width > Screen.width)
+ dx = 0
+ if (keyboardWindow.y < 0)
+ dy = 0
+ if (keyboardWindow.y + keyboardWindow.height > Screen.height)
+ dy = 0
+
+ keyboardWindow.x += dx
+ keyboardWindow.y += dy
+ }
+ }
}
}
diff --git a/tests/manual/x11vkbwrapper/main.cpp b/tests/manual/x11vkbwrapper/main.cpp
index cb8a25dc..6a914792 100644
--- a/tests/manual/x11vkbwrapper/main.cpp
+++ b/tests/manual/x11vkbwrapper/main.cpp
@@ -72,7 +72,6 @@ int main(int argc, char *argv[])
/** Setup DBus ends */
QQmlApplicationEngine engine(QStringLiteral("qrc:/main.qml"));
- engine.load(QStringLiteral("qrc:/keyboard.qml"));
QQmlContext* ctx = engine.rootContext();
@@ -95,21 +94,6 @@ int main(int argc, char *argv[])
}
ctx->setContextProperty("atspiFocus", &handleATSPIEvents);
- QObject *switchObject = engine.rootObjects().first();
- QObject *keyboardObject = engine.rootObjects().last();
- QScreen *screen = app.primaryScreen();
- QRect screenRect = screen->geometry();
- int x1 = 0;
- int y1 = 0;
- int x2 = 0;
- int y2 = 0;
- screenRect.getCoords(&x1, &y1, &x2, &y2);
-
- switchObject->setProperty("x", x2 - switchObject->property("width").toInt());
- switchObject->setProperty("y", y2 - switchObject->property("height").toInt());
- keyboardObject->setProperty("x", x2 - static_cast<int>(screen->size().rwidth()/keyboardObject->property("scaleFactor").toFloat()));
- keyboardObject->setProperty("y", y2 - switchObject->property("height").toInt());
-
QObject::connect(extensionHandler, &HandleDbusForChrome::showKeyboard, &handleATSPIEvents, &HandleATSPIEvents::setKeyboardVisible);
/** Only for testing purpose*/
diff --git a/tests/manual/x11vkbwrapper/main.qml b/tests/manual/x11vkbwrapper/main.qml
index fb5e4dc8..b5a0221f 100644
--- a/tests/manual/x11vkbwrapper/main.qml
+++ b/tests/manual/x11vkbwrapper/main.qml
@@ -27,16 +27,17 @@
**
****************************************************************************/
-import QtQuick 2.9
+import QtQuick 2.12
import QtQuick.Window 2.2
-
Window {
id: window
width: d.vkbSwitchSize
height: d.vkbSwitchSize
+ x: Screen.width - width
+ y: Screen.height - height
color: "transparent"
- visible: !Qt.inputMethod.visible
+ visible: true
flags: Qt.WindowStaysOnTopHint | Qt.WindowDoesNotAcceptFocus | Qt.FramelessWindowHint
QtObject {
@@ -51,10 +52,10 @@ Window {
MouseArea {
anchors.fill: parent
- onClicked: {
- atspiFocus.setKeyboardVisible(!Qt.inputMethod.visible)
- }
+ onClicked: atspiFocus.setKeyboardVisible(!Qt.inputMethod.visible)
}
}
+
+ Keyboard {}
}
diff --git a/tests/manual/x11vkbwrapper/qml.qrc b/tests/manual/x11vkbwrapper/qml.qrc
index 519156ab..b8ccf60e 100644
--- a/tests/manual/x11vkbwrapper/qml.qrc
+++ b/tests/manual/x11vkbwrapper/qml.qrc
@@ -2,6 +2,6 @@
<qresource prefix="/">
<file>main.qml</file>
<file>graphics/Qt_logo.png</file>
- <file>keyboard.qml</file>
+ <file>Keyboard.qml</file>
</qresource>
</RCC>
diff --git a/tests/manual/x11vkbwrapper/x11vkbwrapper.pro b/tests/manual/x11vkbwrapper/x11vkbwrapper.pro
index bb954c80..6dc7226f 100644
--- a/tests/manual/x11vkbwrapper/x11vkbwrapper.pro
+++ b/tests/manual/x11vkbwrapper/x11vkbwrapper.pro
@@ -42,8 +42,6 @@ HEADERS += \
RESOURCES += qml.qrc
-OTHER_FILES += main.qml
-
INCLUDEPATH += /usr/include/X11
INCLUDEPATH += /usr/include/at-spi-2.0
INCLUDEPATH += /usr/lib/x86_64-linux-gnu/glib-2.0/include