我的目标是为 Technexion DevKit TDM-3730 BlizzardPack 制作一个 QT 应用程序。一切都很好,但是用触摸屏点击按钮是不可能的,而用鼠标就可以了。
我试过evtest,这里是它的输出:
root@devkit:/dev/input# evtest touchscreen0
Input driver version is 1.0.1
Input device ID: bus 0x0 vendor 0x0 product 0x0 version 0x0
Input device name: "prism_st"
Supported events:
Event type 0 (Sync)
Event type 1 (Key)
Event code 330 (Touch)
Event type 3 (Absolute)
Event code 0 (X)
Value 115
Min 0
Max 1499
Event code 1 (Y)
Value 397
Min 0
Max 899
Event code 24 (Pressure)
Value 0
Min 0
Max 255
Testing ... (interrupt to exit)
Event: time 10551.906098, type 3 (Absolute), code 0 (X), value 735
Event: time 10551.906129, type 3 (Absolute), code 1 (Y), value 461
Event: time 10551.906129, type 3 (Absolute), code 24 (Pressure), value 255
Event: time 10551.906129, -------------- Report Sync ------------
Event: time 10551.915772, type 3 (Absolute), code 0 (X), value 734
Event: time 10551.915772, type 3 (Absolute), code 1 (Y), value 460
Event: time 10551.915802, -------------- Report Sync ------------
Event: time 10551.925201, type 3 (Absolute), code 0 (X), value 733
Event: time 10551.925201, type 3 (Absolute), code 1 (Y), value 459
Event: time 10551.925232, -------------- Report Sync ------------
Event: time 10551.934570, type 3 (Absolute), code 0 (X), value 732
Event: time 10551.934600, -------------- Report Sync ------------
Event: time 10551.943999, type 3 (Absolute), code 0 (X), value 730
Event: time 10551.944030, type 3 (Absolute), code 1 (Y), value 460
Event: time 10551.944030, -------------- Report Sync ------------
Event: time 10551.951659, type 3 (Absolute), code 0 (X), value 728
Event: time 10551.951690, type 3 (Absolute), code 1 (Y), value 462
Event: time 10551.951690, type 3 (Absolute), code 24 (Pressure), value 28
Event: time 10551.951690, -------------- Report Sync ------------
Event: time 10551.959014, type 3 (Absolute), code 0 (X), value 726
Event: time 10551.959044, type 3 (Absolute), code 1 (Y), value 464
Event: time 10551.959044, type 3 (Absolute), code 24 (Pressure), value 1
Event: time 10551.959044, -------------- Report Sync ------------
无论我点击多少,都没有触摸事件(330)。
我做了一个GTK应用,还可以,但是一点都不方便。并且似乎在 GTK GUI 中实现了触摸事件处理。我对吗?
这是我的系统参数:
Host - Linux Mint 15, Linux version 3.8.0-19-generic, QT 5
Target - Angstrom, Linux version 2.6.37, qt4-embedded - 4.7.3-r33.1.9, tslib
Cpu - TI Sitara DM3730 @ 1Ghz
DSP Core - TMS320C64x+™ @ 800Mhz
导出 TsLib 环境变量:
export TSLIB_TSDEVICE=/dev/input/touchscreen0
export QWS_MOUSE_PROTO=Tslib:/dev/input/touchscreen0
我是 QT(和嵌入式系统)的初学者,所以我正在关注 BeagleBone 上的Derek Molloy 教程http://www.youtube.com/watch?v=kP7uvOu9hoQ 。但我有 Technexion devkit。Beaglebone linux 版本是 3.2.34,我的是 2.6.37。
这是我的测试程序 main.cpp:
#include "mainwindow.h"
#include <QApplication>
#include <QTouchEvent>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
这是mainwindow.cpp:
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
ui->lineEdit->setText("DevKit");
}
在 Derek 的教程中它工作正常。谁能告诉我如何启用 qt 源代码来接受触摸屏事件?
先感谢您。
叶戈尔