Guest User

Untitled

a guest
Jun 8th, 2020
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. import QtQuick 2.14
  2. import QtQuick.Controls 2.12
  3. import QtQuick.Window 2.14
  4.  
  5. Window {
  6. id: root
  7. visible: true
  8. width: 380
  9. height: 640
  10.  
  11. Connections {
  12. target: Qt.inputMethod
  13. onKeyboardRectangleChanged: {
  14. if(Qt.inputMethod.keyboardRectangle.height !== 0) {
  15. rect.y = root.height - rect.height - Qt.inputMethod.keyboardRectangle.height / Screen.devicePixelRatio
  16. }
  17. else {
  18. rect.y = root.height - rect.height
  19. }
  20. }
  21. }
  22. TextField {
  23. anchors {
  24. horizontalCenter: parent.horizontalCenter
  25. }
  26. y: 50
  27. width: parent.width * 0.8
  28. height: 30
  29. inputMethodHints: Qt.ImhNoPredictiveText
  30. font.pointSize: height * 0.4
  31. Keys.onPressed: {
  32. if(event.key === Qt.Key_Return) {
  33. focus = false
  34. }
  35. }
  36. }
  37. Rectangle {
  38. id: rect
  39. anchors {
  40. horizontalCenter: parent.horizontalCenter
  41. }
  42. y: root.height - rect.height
  43. color: "red"
  44. width: parent.width * 0.7
  45. height: 50
  46. border.width: 1
  47. border.color: "#000000"
  48. }
  49. }
Add Comment
Please, Sign In to add comment