Home > other >  How to control the qt own virtual keyboard?
How to control the qt own virtual keyboard?

Time:10-27

See online posts, qt5.7 above their own virtual keyboard, only need to increase qputenv in the main function (" QT_IM_MODULE ", QByteArray (" qtvirtualkeyboard ")); Can then spinbox automatic popup digital virtual keyboard, lineedit pop-up full keyboard virtual keyboard, I ask, is how to control in application number or full keyboard's virtual keyboard, how to control the virtual keyboard is shut, how to control the current input is in English or Chinese, as well as the display position,

CodePudding user response:

I used the qt5.8 why not?

CodePudding user response:

My 5.9.1 also not line, also cannot be used in QML, tip not installed after the import, but in fact is installed, the corresponding files can be found in the documents, please tell me about how to use the building Lord, as long as in the main set the environment variables contained in it is ok?

CodePudding user response:

 images: key. The PNG

CodePudding user response:

The default installation is only in English, Chinese or other languages need to compile the source code to install keyboard keyboard there are two kinds, one kind is shown on the screen, one kind is embedded into the QML component inside, in the figure is embedded components, embedded keyboard can only set the width, height with width automatically change, the control of the keyboard is set in the input control, punctuated with attribute set keyboard mode, open or hidden keyboard have qt global properties, can search to help it!

CodePudding user response:

我总结的:1. Before using qtvirtualkeyboard, you should know:1.1 Project directory: D:\Qt\Qt5.9.0\5.9\Src\qtvirtualkeyboard1.2 Default build directory: D:\Qt\Qt5.9.0\5.9\Src\build-qtvirtualkeyboard-Desktop_Qt_5_9_0_MinGW_32bit-Debug1.3 layouts directory: D:\Qt\Qt5.9.0\5.9\Src\qtvirtualkeyboard\src\virtualkeyboard\content\layouts, A language+country has a corresponding sub-directory. The qml types inherit from KeyboardLayout or KeyboardLayoutLoader. They define the layout of the keys.1.4 styles directory: D:\Qt\Qt5.9.0\5.9\Src\qtvirtualkeyboard\src\virtualkeyboard\content\styles A style has a corresponding sub-directory. The qml type inherits from KeyboardStyle. They define the UI style, such as background images, text fonts and colors.1.5 Sample project directory: D:\Qt\Qt5.9.0\Examples\Qt-5.9\virtualkeyboard2. Build qtvirtualkeyboard2.1 Open project D:\Qt\Qt5.9.0\5.9\Src\qtvirtualkeyboard\qtvirtualkeyboard.pro in qtcreator.2.2 Add CONFIG +=lang-all(or languages we need) in file D:\Qt\Qt5.9.0\5.9\Src\qtvirtualkeyboard\src\virtualkeyboard\virtualkeyboard.pro2.3 Add make install to build steps.2.4 Build projects src\openwnn, src\pinyin, src\tcime firstly.2.5 Build the whole project.3. Using qtvirtualkeyboard3.1 In the main() function: qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); Or, $QT_IM_MODULE=qtvirtualkeyboard myapp3.2 In the main () function: qputenv (" QT_VIRTUALKEYBOARD_STYLE QByteArray (" retro ")); Or, Component. The onCompleted: VirtualKeyboardSettings styleName="retro"; 3.3 Add the following lines to the pro file static {QT + +==SVG QTPLUGIN qtvirtualkeyboardplugin} 3.3 Create InputPanel (Otherwise the virtual the rid_device_info_keyboard will be to the at the bottom of the screen) import QtQuick 2.0 import QtQuick. VirtualKeyboard 2.1 Item {id: root Item {id: appContainer anchors. Left: the parent. The left anchors. The top: the parent. The top anchors. Right: the parent. The right anchors. Bottom: InputPanel. The top... } InputPanel {id: InputPanel y: Qt. InputMethod. Visible? Parent. Height - inputPanel. Height: parent. Height anchors. Left: the parent. The left anchors. Right: the parent. The right}} 3.4 Change VirtualKeyboardSettings, locale, and the current language will Change correspondingly. 3.5 the Property VirtualKeyboardSettings. ActiveLocales can be 2 limit the list of available languages in the application lifetime. 4. Customize style4.1 Create a directory, for example, with a VSS in D: \ 5.9 Qt \ Qt5.9.0 \ \ Src \ qtvirtualkeyboard \ Src \ virtualkeyboard \ content \ styles \; 4.2 Copy all files in D: \ 5.9 Qt \ Qt5.9.0 \ \ Src \ qtvirtualkeyboard \ Src \ virtualkeyboard \ content \ styles \ retro to VSS, change the images files and modify style. The QML. nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related