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

Touch not working in QtWebEngine after opening a DropDown menu



  • Hello everbody!

    I stumbled across a QtWebEngine problem while using a touch display. I can browse normally through websites via my touch display, but when I click on a DropDown menu (for example on https://www.ebay.com/ clicking on "All categories" next to the search field), touch is not working anymore (or 1/30 touch clicks works). I can still close it via mouse/keyboard. After closing the DropDown menu, touch is working again.

    I created a small example browser, there is nothing special in it:

    BrowserWidget::BrowserWidget(QWidget *parent)
        : QWidget(parent), ui(new Ui::BrowserWidget),
          m_webView(new QWebEngineView(this)), m_page(new QWebEnginePage(this)) {
      ui->setupUi(this);
      ui->verticalLayout->addWidget(m_webView);
    
      m_page->setUrl(QUrl(QStringLiteral("https://www.ebay.com/")));
      m_webView->setPage(m_page);
    
      m_webView->setAttribute(Qt::WA_AcceptTouchEvents);
      m_webView->installEventFilter(this);
    }
    
    bool BrowserWidget::eventFilter(QObject *watched, QEvent *e) {
      qDebug() << "event: " << e->type();
    
      if (e->type() == QEvent::ChildAdded) {
        QChildEvent *ce = static_cast<QChildEvent *>(e);
        if (ce && ce->child()) {
          ce->child()->installEventFilter(this);
        }
      }
    
      return false;
    }
    

    I installed my event filter to the widgets in the QEvent::ChildAdded for a better debugging (so I can observe more events). When I close the DropDown with my mouse I get MouseButtonPress, FocusIn, ChildRemoved, ... events. But with touch I only get MouseButtonPress, nothing more.

    This behaviour is always reproducable and I don't know if I did something wrong, because I can operate the browser via touch. I also added the Qt::WA_AcceptTouchEvents to the child widgets or the BrowserWidget itself, but it didn't make any difference.

    I hope somebody of you can help me out, thank you!



  • It's a QT bug ( https://bugreports.qt.io/browse/QTBUG-79254 )

    If somebody every needs it again I implemented a workaround which I posted here:
    https://stackoverflow.com/questions/62152845/touch-freeze-in-qtwebengine-after-opening-a-dropdown-menu