If the keyboard is turned on in the Ubuntu phone

Source: Internet
Author: User

In some applications we need to determine whether the keyboard has appeared. If it does, we sometimes don't want to have a keyboard. We can also use the Software method to make the keyboard disappear. In this article, we'll show you how to implement this.


Import QtQuick 2.0import ubuntu.components 1.1/*! \brief MainView with a Label and Button Elements.*/mainview {//ObjectName for functional testing purposes (autopilot- QT5) ObjectName: "MainView"//note!      ApplicationName needs to match the "name" field of the click Manifest ApplicationName: "Inputmethod.liu-xiao-guo"/* The enables the application to change orientation when the device is rotated.    The default is False.    *///automaticorientation:true//Removes the old toolbar and enables new features of the new header.        Usedeprecatedtoolbar:false width:units.gu (height:units.gu) page {title:i18n.tr ("Inputmethod") Column {spacing:units.gu (2) TextField {id:input} Te XT {text: "Input method:" + "<b>" + Qt.inputMethod.visible + "</b>"} b            Utton {text: "Hide Input Method"    OnClicked: {Qt.inputMethod.hide ();            }}} component.oncompleted: {var keys = Object.keys (Qt.inputmethod);                for (var i = 0; i < keys.length; i++) {var key = Keys[i];                Prints all properties, signals, functions from Object Console.log (key + ': ' + Qt.inputmethod[key]); if (key = = = "Locale") {console.log ("Native lang:" + Qt.inputmethod[key].nativelanguagen                AME);            }} var rect = Qt.inputMethod.keyboardRectangle;        Console.log ("Keyboard size:" + rect.width + "" + rect.height); }    }}



In the example above, we can see that when the keyboard is not started:


Qt.inputMethod.visible


to False. When the keyboard starts, its value becomes true. Of course, we can also pass the method:


Qt. Inputmethod.hide ();

To make the keyboard disappear.



If the keyboard is turned on in the Ubuntu phone

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.