Results 1 to 11 of 11

Thread: Touch not working on qt application using waveshare screen

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2015
    Location
    Ahmedabad, India
    Posts
    12
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Touch not working on qt application using waveshare screen

    Hi,

    Here is the code I have used to capture events.

    setAttribute(Qt::WA_AcceptTouchEvents,true);

    bool CMainWindow::event(QEvent *ev)
    {
    int t = ev->type();
    switch (t) {
    case QEvent::MouseButtonPress:
    qDebug()<<"Mouse button pressed";
    break;
    case QEvent::TouchBegin:
    qDebug()<<"Touch Begin";
    break;
    case QEvent::MouseButtonDblClick:
    qDebug()<<"Mouse button dbl click";
    break;
    case QEvent::MouseButtonRelease:
    qDebug()<<"Mouse button release";
    break;
    case QEvent::TouchUpdate:
    qDebug()<<"Touch Update";
    break;
    case QEvent::TouchCancel:
    qDebug()<<"Touch Cancel";
    break;
    case QEvent::TouchEnd:
    qDebug()<<"Touch End";
    break;
    }
    if(t == QEvent::TouchBegin)
    {
    ev->accept();
    return true;
    }
    else
    return QWidget::event(ev);
    }

    void CMainWindow:n_lbl_i_clicked()
    {
    qDebug()<<"Click Signal Emitted";
    }

    void CMainWindow:n_lbl_i_pressed()
    {
    qDebug()<<"Press Signal Emitted";
    }

    Debug Logs of app when I press or click on button using mouse :-

    Press Signal Emitted
    Click Signal Emitted

    Debug Logs of app when I press or click on button using touch :-

    Touch Begin
    Touch Update
    Mouse button pressed
    Touch Update
    Touch Update
    Touch Update
    Touch Update
    Touch End
    Mouse button release

    Also, I am getting mouse cursor on my application screen and it moves smooth everywhere and emits the click() and press() signal, If I click or press QPushbutton. The same aren't working using touch.

    Thanks
    Last edited by kachhadiyatushar; 25th October 2016 at 11:18.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Touch not working on qt application using waveshare screen

    A few observations/questions:

    * why are you intercepting the TouchBegin event?
    * how did you determine that target and coordinates of the mouse events where OK?
    * have you checked which events are actually delivered to the button?

    Cheers,

  3. #3
    Join Date
    Oct 2016
    Posts
    8
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows Android

    Default Re: Touch not working on qt application using waveshare screen

    I have slot which will be executed by pressing QPushbutton from screen. If I use mouse to press that button works but, not touch. Touch is only responding me the debug messages which I put in source code instead of button press slot work like mouse.

Similar Threads

  1. Touch screen wrong coordinates on touch
    By Talei in forum Qt Programming
    Replies: 0
    Last Post: 1st January 2014, 22:35
  2. QT interfacing with touch screen!!!
    By sanujas in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 5th April 2013, 11:03
  3. Qt Touch Screen Support
    By keyurapatel21 in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 19th October 2011, 18:31
  4. Touch Screen on Windows 7
    By briankibler in forum Qt Programming
    Replies: 2
    Last Post: 2nd March 2011, 14:15
  5. Touch screen
    By rchaitanya in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 19th January 2009, 13:40

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.