I have a simple Qt5.2 application it's built for the TI AM335x EVM (ARM based processor). It just has 1 button on it which enables some LEDs on the board.
The problem I'm having is that the touch event is not calibrated to the screen. Example:
*************
* *
* [] *
* X *
* *
*************
So if the []
is where the button is, the X
is where you have to touch to activate it. It's like it's upside down and backwards. I've tried with larger applications (more buttons) and the trend follows.
Now when I use the Qt4.8 GUI user interface provided by TI, the touch works as expected, so for some reason when I compile by 5.2 code it seems like it needs to be recalibrated, but I'm not sure how to do that.
My questions:
Additional information that may or may not be helpful:
My Qt environment was configured with this command:
./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
Followed by a make
and make install
. My path is updated to include the correct version of the TI toolchain and the home configured/built version of qmake
:
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/bin:/usr/local/Trolltech/Qt-4.8.5/bin:/home/mike/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/mike/bin
Flags used in the actual compile 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. -I../include -I../include/QtWidgets -I../include/QtGui -I../include/QtCore -I. -o main.o main.cpp
The application is launched with:
./touch_keys -platform eglfs
The 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
So I found out that the touch support via tslib
should not be required when using the eglfs platform plugin. eglfs has the evdev input handlers built-in so mouse/keyboard/touch support come without needing anything else to connect to the correct device.
This means that evdevtouch is failing to recognize the touch screen on am335x, this was supposed to be corrected in 5.2, but clearly still isn't. The "fix" (workaround) is to flip the screen manually by exporting an QPA environment variable:
export QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS="rotate=180"
This properly transforms the coordinates.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With