Qt virtualkeyboard-自定义布局不会影响键盘高度吗?

时间:2019-04-11 08:00:36

标签: c++ qt qml virtual-keyboard

我正在尝试使用Qt虚拟键盘。我想调整键盘的高度。因此,我开始按照Qt虚拟键盘的文档所述创建自己的键盘布局。但是布局仅更改一行中的键数。即使我写下按键选项的重量或行高,也不是行高或按钮大小。我想念什么吗?贝娄是我到目前为止的一些代码:

KeyboardLayout {
    inputMode: InputEngine.InputMode.Latin
    keyWeight: 300

    KeyboardRow {
      Key {
          key: Qt.Key_Q
          text: "q"
          weight:600
          height: 100
      }
      Key {
          key: Qt.Key_W
          text: "w"
          weight:600
      }
      Key {
          key: Qt.Key_E
          text: "e"
          weight:600
      }
      Key {
          key: Qt.Key_R
          text: "r"
          weight:600
      }

      Key {
          key: Qt.Key_T
          text: "t"
          weight:600
      }
    }
    KeyboardRow {
      Key {
          key: Qt.Key_Z
          text: "z"
      }
      Key {
          key: Qt.Key_U
          text: "u"
      }
      Key {
          key: Qt.Key_I
          text: "i"
      }
      Key {
          key: Qt.Key_O
          text: "o"
      }

      Key {
          key: Qt.Key_P
          text: "p"
      }
    }

    KeyboardRow {
      Key {
          key: Qt.Key_Udiaeresis
          text: "ü"
      }
      BackspaceKey {}


      FillerKey {
          weight: 66
      }
      Key {
          key: Qt.Key_A
          text: "a"
      }
      Key {
          key: Qt.Key_S
          text: "s"
          alternativeKeys: "sß"
      }
    }

    KeyboardRow {
      Key {
          key: Qt.Key_D
          text: "d"
      }
      Key {
          key: Qt.Key_F
          text: "f"
      }
      Key {
          key: Qt.Key_G
          text: "g"
      }
      Key {
          key: Qt.Key_H
          text: "h"
      }
      Key {
          key: Qt.Key_J
          text: "j"
      }
    }
    KeyboardRow {
      Key {
          key: Qt.Key_K
          text: "k"
      }
      Key {
          key: Qt.Key_L
          text: "l"
      }
      Key {
          key: Qt.Key_Odiaeresis
          text: "ö"
      }
      Key {
          key: Qt.Key_Adiaeresis
          text: "ä"
      }
      EnterKey {
          weight: 283
      }
    }
    KeyboardRow {
      keyWeight: 156
      ShiftKey { }
      Key {
          key: Qt.Key_Y
          text: "y"
      }
      Key {
          key: Qt.Key_X
          text: "x"
      }
      Key {
          key: Qt.Key_C
          text: "c"
      }
      Key {
          key: Qt.Key_V
          text: "v"
      }
    }
    KeyboardRow {
      Key {
          key: Qt.Key_B
          text: "b"
      }
      Key {
          key: Qt.Key_N
          text: "n"
      }
      Key {
          key: Qt.Key_M
          text: "m"
      }
      Key {
          key: Qt.Key_Comma
          text: ","
      }
      Key {
          key: Qt.Key_Period
          text: "."
      }
    }
    KeyboardRow {
      keyWeight: 154
      Key {
          key: Qt.Key_Minus
          text: "-"
      }
      ShiftKey {
          weight: 264
      }
      SymbolModeKey {
          weight: 217
      }
      ChangeLanguageKey {
          weight: 154
      }
      HandwritingModeKey {
          weight: 154
      }
    }
    KeyboardRow {
      SpaceKey {
          weight: 864
      }
      Key {
          key: Qt.Key_Apostrophe
          text: "'"
      }
      Key {
          key: 0xE000
          text: ":-)"
          alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
      }
      HideKeyboardKey {
          weight: 204
      }
    }
}

我想调整键盘的高度。例如,现在它根据宽度计算高度,因此,假设它的高度为250像素,接下来的400像素为空。因此,我认为通过自定义布局和更改键的权重,高度也会增加,但这只会使键盘上的键变宽,因此它们会填满整个键盘行。

0 个答案:

没有答案