2017-03-16 107 views
2

有没有办法在不使用自定义布局的情况下从虚拟键盘隐藏语言选择键?从Qt隐藏密钥虚拟键盘

enter image description here

+0

我不熟悉虚拟键盘,但这听起来像一个自定义布局。如果键盘支持更改布局,则应该可以隐藏它。我真的怀疑它支持隐藏特定的键。 – rbaleksandar

回答

1

我能隐藏与解决方法的语言键:

property var keyboardLayout: inputPanel.keyboard.layout 


    function findChildByProperty(parent, propertyName, propertyValue, compareCb) { 
     var obj = null 
     if (parent === null) 
      return null 
     var children = parent.children 
     for (var i = 0; i < children.length; i++) { 
      obj = children[i] 
      if (obj.hasOwnProperty(propertyName)) { 
       if (compareCb !== null) { 
        if (compareCb(obj[propertyName], propertyValue)) 
         break 
       } else if (obj[propertyName] === propertyValue) { 
        break 
       } 
      } 
      obj = findChildByProperty(obj, propertyName, propertyValue, compareCb) 
      if (obj) 
       break 
     } 
     return obj 
    } 



    onKeyboardLayoutChanged: { 
     if(keyboardLayout!=""){ 
      var ChangeLanguageKey= findChildByProperty(inputPanel.keyboard, "objectName", "changeLanguageKey", null) 
      if(ChangeLanguageKey){ 
       ChangeLanguageKey.visible=false 
      } 
     } 
    } 


    InputPanel { 
     id: inputPanel 
     z: 99 
     y: parent.height 
     anchors.left: parent.left 
     anchors.right: parent.right 




     states: State { 
      name: "visible" 

      when: inputPanel.active 
      PropertyChanges { 
       target: inputPanel 
       y: parent.height - inputPanel.height 
      } 
     } 
     transitions: Transition { 
      from: "" 
      to: "visible" 
      reversible: true 
      ParallelAnimation { 
       NumberAnimation { 
        properties: "y" 
        duration: 400 
        easing.type: Easing.InOutBack 
       } 
      } 
     } 





     CustomComponents.AutoScroller { 

      id:autoscroller 

      panelY: inputPanel.y 
     } 


    } 

enter image description here

这仅在5.9版本的作品,其中对象名属性与“changeLanguageKey”规定,对于以前的版本设置源代码中的属性并重新编译。

1

不,如果不使用自定义布局。

您可以随时修改,虽然配备了键盘的布局。