无法通过Qt和Angstrom获得触摸事件

时间:2013-10-18 18:16:07

标签: qt events touch angstrom-linux beagleboneblack

我的目标是为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源代码来接受触摸屏事件?

提前谢谢。

叶戈尔

1 个答案:

答案 0 :(得分:0)

我认为您可能会发现此视频在设置QT环境和配置BBB中嵌入的QT时非常有用。

[Beaglebone:用于C ++ ARM嵌入式Linux开发的Qt Creator]