Important: Please read the Qt Code of Conduct -

Mouse (touch) events also being passed to OS

  • Hi there,
    I'm fairly new to Qt and have managed to get a Qt development environment running on a host laptop and being deployed on a Raspberry Pi running Rasbian with a USB touch panel.

    The issue that I have is that when I either debug/run from the remote laptop or run the program directly from the Pi, the button/slider/rectangle mouse events (or in this case, touch presses) are still being detected by the Raspberry Pi OS in the background.
    This means that upon exiting the Qt application, various things have been "clicked" and run in the background.

    Is there something I've forgotten to set/disable in the .pro file or qml files?
    Any help would be really appreciated.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What platform plugin are you using for your application ?

  • Hi Sgaist, thanks for your reply.
    I appologize, but I do not understand the question. How do I obtain which plugin you are referring to?

    I can conclude, however, that it is the touch driver, when using a USB corded mouse the events are constrained to the Qt application.

  • Lifetime Qt Champion

    The embedded Linux chapter of Qt's documentation will best answer that question.

    Ok, then how are you starting your application ? (parameters etc.)

  • Hi there,

    My main.qml file starts as follows:

    import QtQuick 2.0
    import QtQuick.Controls 1.0
    import QtQuick.Controls.Styles 1.0
    import com.connect 1.0
    Rectangle {
        id: screen
        width: 1024; height: 600
        color: "#101320"
        Connector{ id: hw_connector}
        property alias val: slider1.value

    with the main.cpp file:

    #include "uart.h"
    #include "connector_class.h"
    #include <QtGui/QtGui>
    #include <QtQuick/QtQuick>
    int main(int argc, char *argv[])
        QGuiApplication app(argc, argv);
        qmlRegisterType<Connector_class>("com.connect", 1, 0, "Connector");
        QQuickView view;
        view.setSource(QUrl(QCoreApplication::applicationDirPath() + "/qml/main.qml"));;
        return app.exec();

    I'm planning on using a single class (com.connector) back to the C++ realm to deal with the Raspberry PI's UART which communicates to a custom STM32 based embedded environment. This is currently being emulated whilst the HW is being developed.

  • Lifetime Qt Champion

    Sorry, I meant when you start your application, what parameters do you pass on the command line ?

    Does init_uart use any QObject ?

Log in to reply