编译安装
正常情况下该插件都是需要自行编译的. 方法也简单得要死
在QT源码中有qtvirtualkeyboard
这样一个目录, 进入该目录然qmake对应的pro文件,生成makefile后make/make install就行了. qmake时需要加对应参数,比如
qmake ../ CONFIG+="lang-en_GB lang-zh_CN"
config参数参考这里https://doc.qt.io/qt-5/qtvirtualkeyboard-build.html
使用
在main函数中增加 qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
在创建工程时选择
qtvirtualkeyboard
时会在pro中增加 qt+=qtvirtualkeyboard, 需要删除掉,编译不过,也许是个案
然后就可以在qml中
import QtQuick 2.9
import QtQuick.Window 2.2
import QtQuick.VirtualKeyboard 2.2
Window {
id: window
visible: true
width: 640
height: 480
title: qsTr("Hello World")
TextInput{
text: "xxxx"
}
InputPanel {
id: inputPanel
z: 99
x: 0
y: window.height
width: window.width
states: State {
name: "visible"
when: inputPanel.active
PropertyChanges {
target: inputPanel
y: window.height - inputPanel.height
}
}
transitions: Transition {
from: ""
to: "visible"
reversible: true
ParallelAnimation {
NumberAnimation {
properties: "y"
duration: 250
easing.type: Easing.InOutQuad
}
}
}
}
}
正文完