如何使用箭头在 QtVirtualKeyboard 中导航 [英] How to use arrows to navigate through a QtVirtualKeyboard

查看:90
本文介绍了如何使用箭头在 QtVirtualKeyboard 中导航的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过系统键盘上的按键控制 QtVirtualKeyboard,这是一个带有有限键的嵌入式系统,例如只有箭头.问题是我尝试过的一切,我看到的建议似乎不起作用.

I want to control the QtVirtualKeyboard with keypresses on a system keyboard, wich is an embedded system with limited keys, for example only arrows. The problem is everything I have tried and I have seen suggested doesnt seem to work.

我看过这个帖子:QT,如何专注于虚拟键盘,并使用键盘控制虚拟键盘

我的 .pro 有以下配置:

My .pro has the following config:

CONFIG += c++11 arrow-key-navigation disable-desktop qml_debug

我的 main.cpp 有:

My main.cpp has:

qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));

我仍然无法在键盘上使用箭头导航.我的主要目标是覆盖一些键盘按下(在嵌入式系统上)并将它们转换为键盘移动和按下.

I still can´t get the arrow navigation working on the keyboard. My main goal is override some keyboard presses (on the embedded system) and translate them to keyboards movements and presses.

我还尝试了 qtcreator 示例,正如上面的帖子所建议的:

I also tried on the qtcreator example as the post above suggests:

还建议构建 examples/virtualkeyboard/basic/禁用桌面选项并使用它的源作为示例.

Also recommend to build examples/virtualkeyboard/basic/ with disable-desktop option and use it sources as example.

我的环境是 Qt Creator 4.7.0 Community、Windows 10、Qt 5.11.1 和

My environment is Qt Creator 4.7.0 Community, Windows 10, Qt 5.11.1 and

import QtQuick 2.6
import QtQuick.Window 2.0
import QtQuick.Controls 2.0
import QtQuick.VirtualKeyboard 2.0

推荐答案

该配置用于从 qt 源构建 qtvirtualkeyboard.您需要按照以下链接构建虚拟键盘的指南进行操作:

The config is for building qtvirtualkeyboard from the qt source. What you need to do following the guideline of Building Virtual Keyboard as the following link below:

https://doc.qt.io/qt-5/qtvirtualkeyboard-build.html

在构建命令中添加 CONFIG+=arrow-key-navigation 参数或将其直接添加到 .pro 文件中.

with adding CONFIG+=arrow-key-navigation argument to the build command or adding it directly into .pro file.

构建完成后,在构建输出目标下运行make install"命令来部署您的qtvirtualkeyboard,然后就可以使用了.

After the build is done, run "make install" command under build output destination to deploy your qtvirtualkeyboard then it is ready to use.

这篇关于如何使用箭头在 QtVirtualKeyboard 中导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆