重新加载 tslib 触摸屏校准

发布于 2024-10-08 13:16:57 字数 535 浏览 1 评论 0原文

背景: 我正在开发一个基于 Qt 的大型 GUI,它处理与触摸屏的所有用户交互。该程序的设计使得用户不需要访问命令提示符即可执行任何操作,包括重新校准触摸屏。我编写了 tslib 的 ts_calibrate 实用程序的仿制品,它作为 QWidget 运行,并且可以修改 /etc/pointercal 中的 tslib 校准文件。

但是,虽然我可以修改校准文件,但在关闭并重新启动程序之前,对校准的更改似乎不会应用。我已经编写了一个可以处理重新打开程序的脚本,但我想找到一种更优雅的方法来执行此操作,以便将用户的麻烦保持在最低限度。

简单地说, Qt 的类之​​一中是否有一个函数可以动态重新加载 tslib 的校准文件,而无需重新启动应用程序?我查看了 QWSServer 类参考,但没有找到任何类似的内容它做我想做的事。

Background: I am working on a somewhat large Qt-based GUI which handles all user interaction with a touch screen. The program is designed such that the user should not need to access a command prompt in order to do anything, including recalibrating the touch screen. I have written an imitation of tslib's ts_calibrate utility which runs as a QWidget and can modify tslib's calibration file at /etc/pointercal.

However, although I can modify the calibration file, changes to the calibration do not seem to be applied until I close and restart the program. I have written a script which can handle re-opening the program, but I would like to find a more elegant way of doing this so that the user's hassle is kept to a minimum.

Simply put, is there a function available in one of Qt's classes which will reload tslib's calibration file on the fly, without restarting the application? I have looked through the QWSServer class reference but I did not find anything that looks like it does what I want it to.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

请你别敷衍 2024-10-15 13:16:57

事实证明,可以在不重新启动应用程序的情况下重新加载驱动程序。为此,您可以使用 QWSServer 类 像这样:

#include <QWSServer>

...

QWSServer::instance()->closeMouse();
QWSServer::instance()->openMouse();

这将导致重新加载 tslib 的校准文件。例如,如果您以错误的校准启动程序,请在程序运行时更正触摸屏的校准文件,然后调用这些方法,指针将调整为新的校准。

It turns out that the driver can be reloaded without restarting the application. To do so, you can close and re-open the pointer device(s), using methods in the QWSServer class like so:

#include <QWSServer>

...

QWSServer::instance()->closeMouse();
QWSServer::instance()->openMouse();

This will cause a reload of tslib's calibration file. E.g., if you started the program with a faulty calibration, correct the calibration file for the touch screen while the program is running, then invoke those methods, the pointer will adjust to the new calibration.

心凉 2024-10-15 13:16:57

tslib 与 Qt 无关。您可以下载 tslib 的源代码并查看tests/ts_calibrate.c 的作用。

tslib has nothing to do with Qt. You can download the sources of tslib and look what tests/ts_calibrate.c does.

明媚殇 2024-10-15 13:16:57

ts_reconfig() 应该做你想要什么。

ts_reconfig() should do what you want.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文