qt5软虚拟键盘使用
.pro文件修改
qt5要使用虚拟键盘只能使用qml布局,不然无法使用
工程文件.pro
增加
DEFINES += QT_QML
QT += qml quick
RESOURCES += \
demo.qrc
OTHER_FILES += \
virkey.qml
demo.qrc中增加virkey.qml
qml布局文件
virkey.qml文件内容如下
import QtQuick 2.0
import QtQuick.Window 2.2
import QtQuick.VirtualKeyboard 2.1
Window {
visible: true
width: 1024
height: 600
TextInput {
text: "11111111111"
font.pointSize: 20
anchors { left: parent.left; right: parent.right; margins: 12 }
}
TextEdit {
anchors.centerIn: parent
width: 500
height: 200
text: "+++test+++"
focus: true
color: "blue"
font.pointSize: 20
readOnly: false
}
In