0

I develop a Q5 embedded application on RPi3 and I'm having trouble with the touchscreen.

My problem: The touch area is stretched.

In the picture below, the touch area of the buttons at the corners is indicated with red. enter image description here

My hardware:

  • Raspberry pi 3
  • Lilliput OF1011/C/T- 10.1" HDMI touchscreen 1024x600

My environment:

The qt5 is cross compiled with the EGLFS plugin, on Raspbian Stretch Lite image.

I have declare the following environment variables in order to configure EGLFS

QT_QPA_EGLFS_PHYSICAL_HEIGHT=170
QT_QPA_EGLFS_PHYSICAL_WIDTH=270
QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=rotate=90

My C++ code:

#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QByteArray>
#include <QNetworkAccessManager>
#include <QUrl>
#include <QQmlContext>
#include <QQuickItem>
#include <QQuickView>
#include <QObject>

int main(int argc, char *argv[])
{
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    QGuiApplication app(argc, argv);

    QQuickView view;

    view.setSource(QUrl("main.qml"));
    view.setResizeMode(QQuickView::SizeRootObjectToView);

    QObject::connect(view.engine(), SIGNAL(quit()), &view, SLOT(close()));
    view.show();

    return app.exec();
}

My QML code:

import QtQuick 2.7
import QtQuick.Controls 1.0
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.0
import QtQuick.Window 2.0

Item {
    width: Screen.width
    height: Screen.height
    property alias button: button
    Rectangle {
        anchors.fill: parent
        color: "green"
    }

    Button {
        id: button
        width: 232
        height: 107
        anchors.centerIn: parent
        text: qsTr("Press Me")
        onClicked: {
            console.log("width", Screen.width)
            console.log("height", Screen.height)
        }
    }

    Button {
        id: button1
        width: 232
        height: 107
        anchors.left: parent.left
        anchors.top: parent.top
        text: qsTr("Press Me")
    }

    Button {
        id: button2
        width: 232
        height: 107
        anchors.left: parent.left
        anchors.bottom: parent.bottom
        text: qsTr("Press Me")
    }

    Button {
        id: button3
        width: 232
        height: 107
        anchors.right: parent.right
        anchors.bottom: parent.bottom
        text: qsTr("Press Me")
    }

    Button {
        id: button4
        width: 232
        height: 107
        anchors.right: parent.right
        anchors.top: parent.top
        text: qsTr("Press Me")
    }
}

Qt Logging

I have enable the Qt logging as desciped in Qt documentation and I cant find any problem. The output is this:

qt.qpa.egldeviceintegration: EGL device integration plugin keys: ("eglfs_brcm")
qt.qpa.egldeviceintegration: EGL device integration plugin keys (sorted): ("eglfs_brcm")
qt.qpa.egldeviceintegration: Trying to load device EGL integration "eglfs_brcm"
qt.qpa.egldeviceintegration: Using EGL device integration "eglfs_brcm"
qt.qpa.input: Found matching devices ()
qt.qpa.input: evdevtouch: Using device discovery
qt.qpa.input: static device discovery for type QFlags(0x2|0x4)
qt.qpa.input: doing static device discovery for  "/dev/input/event0"
qt.qpa.input: doing static device discovery for  "/dev/input/event1"
qt.qpa.input: Found touchscreen at "/dev/input/event1"
qt.qpa.input: doing static device discovery for  "/dev/input/js0"
qt.qpa.input: doing static device discovery for  "/dev/input/mice"
qt.qpa.input: doing static device discovery for  "/dev/input/mouse0"
qt.qpa.input: doing static device discovery for  "/dev/input/mouse1"
qt.qpa.input: Found matching devices ("/dev/input/event1")
qt.qpa.inp ut: evdevtouch: Adding device at "/dev/input/event1"
qt.qpa.input: evdevtouch: Using device /dev/input/event1
qt.qpa.input: evdevtouch: /dev/input/event1: Protocol type A  (single)
qt.qpa.input: evdevtouch: /dev/input/event1: min X: 30 max X: 4040
qt.qpa.input: evdevtouch: /dev/input/event1: min Y: 60 max Y: 4035
qt.qpa.input: evdevtouch: /dev/input/event1: min pressure: 0 max pressure: 0
qt.qpa.input: evdevtouch: /dev/input/event1: device name: eGalax Inc. USB TouchController
JIT is disabled for QML. Property bindings and animations will be very slow. Visit https://wiki.qt.io/V4 to learn about possible solutions for your platform.
qt.qpa.input: evdevtouch: Updating QInputDeviceManager device count: 1  touch devices, 0 pending handler(s)

Any advice would be usefull

EDIT 1

Ok I found the problem with the overscan. It was my fault because I draw the buttons in the corners with fixed values and my Root Item is resized based on the screen device (width: Screen.width height: Screen.height). But still the touch problem remains.

3
  • Are you sure it isn't the whole screen including your app itself isn't scaled up too far? You might try fiddling with the overscan settings. – goldilocks Nov 4 '17 at 18:14
  • Before I run the app, the console is displayed properly. I have actually disabled the overscan in order the screen to work properly. The problem occurs when i run my application. – dakridas Nov 4 '17 at 18:24
  • So I tried with a different touch screen and the application is working perfect. I think the problem is in the touch sreen itself. – dakridas Dec 11 '17 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.