我们使用 Qt Design Studio 创建了 qml 界面时勾选虚拟键盘会默认在主程序中添加下面这串代码,这串代码用于实例化一个虚拟键盘。
InputPanel {
id: inputPanel
property bool showKeyboard : active
y: showKeyboard ? parent.height - height : parent.height
Behavior on y {
NumberAnimation {
duration: 200
easing.type: Easing.InOutQuad
}
}
anchors.leftMargin: Constants.width/10
anchors.rightMargin: Constants.width/10
anchors.left: parent.left
anchors.right: parent.right
}
我们将创建好的 Qt Design Studio 的项目复制到一个新创建的 Qt Creator 项目中
目录结构:
├── main.cpp
├── main.qml
├── qml
│ ├── fonts
│ │ ├── fonts.txt
│ │ ├── 字体1.ttf
│ │ └── 字体2.otf
│ ├── img
│ │ └── icon_config.png
│ ├── imports
│ │ └── mydemo
│ │ ├── Constants.qml
│ │ ├── designer
│ │