仅当我触摸屏幕的可编辑部分而不单击鼠标时,才显示虚拟键盘

时间:2019-02-08 07:02:09

标签: qt qml

我正在研究qt qml应用程序,并且想使用qt quick的虚拟键盘功能。但我希望仅当我触摸笔记本电脑屏幕时才会显示虚拟键盘。我的当前解决方案即使在可编辑区域上单击鼠标,也会启动虚拟键盘。

我尝试了很多,但无法接近解决方案。我当时想抑制输入面板上的鼠标单击事件,但不知道如何

import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QtQuick.Layouts 1.1
import QtQuick.VirtualKeyboard 2.1
import QtQuick.Window 2.12
ApplicationWindow {
visible: true
width: 720
height: 480
minimumWidth: 400
minimumHeight:350

TabView {
    id:frame
    anchors.fill: parent
    style: myTabViewStyle
    implicitHeight: 100
Tab{
        id: setupPage
        objectName:"TabParentOfSetup"
        enabled: true
        title: "Setup"
        active: true
        SetupTab { }
   }

Tab{
        id:tabletab
        objectName: "TabParentOfTable"
        title: "Table"
        TableTab{}
   }

 }

statusBar: StatusBar
{
Label{
    id: label
}
}
InputPanel {
        id: inputPanel
        y: Qt.inputMethod.visible ? parent.height - inputPanel.height : 
           parent.height
        anchors.right: parent.right
        anchors.left: parent.left
    }
}

0 个答案:

没有答案