Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

[[qanda:topic_unsolved]] Touch not working in QtWebEngine after opening a DropDown menu

$
0
0

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!


Viewing all articles
Browse latest Browse all 13965

Trending Articles