Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.14
- import QtQuick.Controls 2.12
- import QtQuick.Window 2.14
- Window {
- id: root
- visible: true
- width: 380
- height: 640
- Connections {
- target: Qt.inputMethod
- onKeyboardRectangleChanged: {
- if(Qt.inputMethod.keyboardRectangle.height !== 0) {
- rect.y = root.height - rect.height - Qt.inputMethod.keyboardRectangle.height / Screen.devicePixelRatio
- }
- else {
- rect.y = root.height - rect.height
- }
- }
- }
- TextField {
- anchors {
- horizontalCenter: parent.horizontalCenter
- }
- y: 50
- width: parent.width * 0.8
- height: 30
- inputMethodHints: Qt.ImhNoPredictiveText
- font.pointSize: height * 0.4
- Keys.onPressed: {
- if(event.key === Qt.Key_Return) {
- focus = false
- }
- }
- }
- Rectangle {
- id: rect
- anchors {
- horizontalCenter: parent.horizontalCenter
- }
- y: root.height - rect.height
- color: "red"
- width: parent.width * 0.7
- height: 50
- border.width: 1
- border.color: "#000000"
- }
- }
Add Comment
Please, Sign In to add comment