Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to configure Qt to use tslib instead of evdev?
Forum Updated to NodeBB v4.3 + New Features

How to configure Qt to use tslib instead of evdev?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
1 Posts 1 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rrd0
    wrote on last edited by rrd0
    #1

    I'm trying to run Qt applications on a Raspberry Pi 3 that have a Waveshare LCD Touchscreen (with resistive touch) as IO. The Qt version I'm using is 5.12 and the Raspberry Pi's Operating System is Raspbian Stretch. I'm using tslib as the input driver, cause evdev is not working properly with my touch.

    tslib solved a problem I have with evdev, but created some new problems:

    If I press the widget and hold it down for some time, it generates one MousePress, wait some milliseconds, then generate two more MousePresses.

    When I just click (press immediately followed by release) some widget, tslib generates two MousePresses and two MouseReleases instead of one each.

    Here are the environment variables I have defined on /etc/environment:

    QT_QPA_PLATFORM=xcb
    QT_QPA_FB_TSLIB=1
    QT_PLUGIN_PATH=/usr/local/qt5pi/plugins
    QT_QPA_PLATFORM_PLUGIN_PATH=/usr/local/qt5pi/plugins/platforms
    QT_QPA_GENERIC_PLUGINS=tslib:/dev/input/touchscreen
    TSLIB_TSEVENTTYPE=INPUT
    TSLIB_FBDEVICE=/dev/fb0
    TSLIB_TSDEVICE=/dev/input/touchscreen
    TSLIB_CALIBFILE=/etc/pointercal
    TSLIB_CONFFILE=/etc/ts.conf
    TSLIB_PLUGINDIR=/usr/local/lib/ts
    

    And here is the code I'm using to test tslib:

    #include <QApplication>
    #include <QPushButton>
    #include <QDebug>
    
    class Button : public QPushButton
    {
        Q_OBJECT
    public:
        using QPushButton::QPushButton;
    protected:
        void mousePressEvent(QMouseEvent* event) override { QPushButton::mousePressEvent(event); qDebug() << "Pressed"; }
        void mouseReleaseEvent(QMouseEvent* event) override { QPushButton::mouseReleaseEvent(event); qDebug() << "Released"; }
    };
    
    int main(int argc, char* argv[])
    {
        QApplication app(argc, argv);
    
        Button button {"button"};
        button.setFixedSize({60, 30});
        button.show();
    
        return app.exec();
    }
    

    Running the code above and clicking (press immediately followed by release) the button, I get the following output:

    Pressed
    Released
    Pressed
    Released
    

    And when I press the button, hold it down, and then release, I get this:

    Pressed
    Pressed
    Pressed
    Released
    

    What could be wrong with my system? Is there any Qt environment variable I forgot to define? Do I need to disable evdev to use tslib?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved