QT自带虚拟键盘问题汇总

1、QT6.4.2版本:

1)quickwidget 不支持触屏,怎么调试也无效

setAttribute(Qt::WA_AcceptTouchEvents); 无效,本来就是。   

QQuickWidget *quickWidget = new QQuickWidget(this);
    quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView);
    quickWidget->setAttribute(Qt::WA_AcceptTouchEvents);
    quickWidget->setSource(QUrl("qrc:/keyboard.qml"));
    quickWidget->show();

2)如果qml用window{}可以,但用Item{} Reatagle{}都不行

import QtQuick 2.12
import QtQuick.Window 2.2
import QtQuick.VirtualKeyboard 2.4
import QtQuick.VirtualKeyboard.Settings 2.2
import QtQuick
import QtQuick.Controls

//Window 新建了个窗口,可以支持触摸
Item  {
    visible: true
 //   width: 640
 //   height: 480
    id:appContainer

    property string user: user.text
    property string pwd: pwd.text

    signal cleanUserPwd()
    onCleanUserPwd:{
        user.text=""
    

你可能感兴趣的:(qt,开发语言)