Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Does QEvent work on Windows 10 x64 with touchpad



  • Hello everyone ,

    I’m writing windows application which allow user to change a size and position of the specific area by using notebook touchpad. For this purpose I used QEvent Class. But this can identify only a scroll gesture (QEvent::Type::Wheel), as to other gestures - there is no reaction. I created a simple app by using examples but got the same result

    What am I doing wrong?

    Here is a code of my simple app

    #include "mainwindow.h"
    #include <QApplication>
    
    
    MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent)
    {
        if(QCoreApplication::testAttribute(Qt::AA_DontCreateNativeWidgetSiblings)==false)
            setAttribute(Qt::WA_NativeWindow);
        setAttribute(Qt::WA_AcceptTouchEvents, true);
    
        setMinimumSize(640, 480);
        m_label = new QLabel("No Events Before", this);
        m_label->setFont(QFont("Arial", 24));
        m_label->setAlignment(Qt::AlignCenter);
        m_label->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
        setCentralWidget(m_label);
        installEventFilter(this);
    }
    
    bool MainWindow::eventFilter(QObject *, QEvent *event)
    {
        QString msg;
        switch (event->type())
        {
        case QEvent::TouchBegin:
            msg = "TouchBegin";
            break;
        case QEvent::TouchUpdate:
            msg = "TouchUpdate";
            break;
        case QEvent::TouchEnd:
            msg = "TouchEnd";
            break;
        case QEvent::Gesture:
            msg = "Gesture";
            break;
        case QEvent::Type::Wheel:
            msg = "Wheel";
            break;
        case QEvent::Type::GestureOverride:
            msg = "GestureOverride";
            break;
        }
        if (!msg.isEmpty())
            m_label->setText(msg + "Event");
        return false;
    }
    

    project structure

    Qt5Core.dll
    Qt5Gui.dll
    Qt5Widgets.dll
    app.exe
    platforms/qwindows.dll
    

    Environment:
    Qt 5.6.2 64bit
    Windows7 and10 64bit
    compiler VC2015 CE 64bit

    Touchpad drivers are installed and native windows applications responds to gestures


Log in to reply