How do you recalibrate touch events for a Qt application?

I have a simple Qt5.2 application that it is built for the TI AM335x EVM (ARM based processor). It has only 1 button, which allows some LEDs on the board.

The problem I am facing is that the touch event is not calibrated on the screen. Example:

************* * * * [] * * X * * * ************* 

So if [] is where the button is, X is where you need to touch to activate it. It is as if upside down and backward. I tried with large applications (more buttons) and the trend follows.

Now when I use the Qt4.8 GUI provided by TI, the touch works as expected, so for some reason, when I compile the 5.2 code, it seems to need to be recalibrated, but I'm not sure how to do it .

My questions:

  • Does anyone who works with Qt come across something like this in the past?
  • Anyone who knows Qt knows if it is possible to recalibrate programmatically? (I can not find anything about this on the Qt website)

Additional information that may or may not be useful:

In my Qt environment, this command was configured:

./configure -prefix / usr / Qt5.2 -xplatform linux-am335x-g ++ -no-sse -no-sse2 -no-glib -no-cups -no-largefile -no-accessibility -no-openssl - no-gtkstyle -opensource

The following are make and make install . My path is being updated to include the correct version of the TI toolchain and the qmake home / configuration version:

mike @ mike-VirtualBox: /usr/Qt5.2/test_button$ echo $ PATH
/usr/Qt5.2/bin : /home/mike/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/ben : / USR / local / Trolltech / Qt -4.8.5 / bin: / Home / microphone / bin: / USR / Library / LightDM / LightDM: / USR / local / SBIN: / USR / local / bin: / USR / SBIN: / USR / bin: / SBIN: / bin: / usr / games: / home / microphone / bin

Flags used in a valid compilation command:

arm-linux-gnueabihf-g ++ -c -march = armv7-a -marm -mthumb-interwork -mfloat-abi = hard -mfpu = neon -mtune = cortex-a8 -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG - DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I ../ mkspecs / linux-am335x-g ++ -I. -I AM. -I ../include -I ../include/QtWidgets -I ../include/QtGui -I ../include/QtCore -I. -o main.o main.cpp

The application is launched using:

./touch_keys -platform eglfs

Application:

main.cpp:

 #include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication app(argc, argv); MainWindow mainWindow; mainWindow.showMaximized(); return app.exec(); } 

mainwindow.cpp

 #include "mainwindow.h" #include <QtCore/QCoreApplication> #include <QDebug> #include <QFile> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { // Create the button, make "this" the parent m_button = new QPushButton("Light LEDs", this); // set size and location of the button m_button->setGeometry(QRect(QPoint(100, 100), QSize(200, 50))); // Connect button signal to appropriate slot connect(m_button, SIGNAL(released()), this, SLOT(handleButton())); } void MainWindow::handleButton() { char buf[10]; // change the text m_button->setText("Boom"); // resize button m_button->resize(100,100); } 

mainwindow.h

 #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QPushButton> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); private slots: void handleButton(); private: QPushButton *m_button; }; #endif // MAINWINDOW_H 
+6
source share
1 answer

So, I found out that touch support with tslib not required when using the eglfs platform plugin. eglfs has built-in evdev input handlers, so mouse / keyboard / touch support comes without needing anything else to connect to the correct device.

This means that evdevtouch does not recognize the touch screen on am335x, this should have been fixed in 5.2, but obviously this is not the case. Fix (workaround) is to click on the screen manually by exporting the QPA environment variable:

 export QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS="rotate=180" 

This correctly converts the coordinates.

+10
source

All Articles