| 321 | } |
| 322 | |
| 323 | bool StandardDocumentationView::eventFilter(QObject* object, QEvent* event) |
| 324 | { |
| 325 | Q_D(StandardDocumentationView); |
| 326 | |
| 327 | if (object == d->m_view) { |
| 328 | /* HACK / Workaround for QTBUG-43602 |
| 329 | * Need to set an eventFilter on the child of WebengineView because it swallows |
| 330 | * mouse events. |
| 331 | */ |
| 332 | if (event->type() == QEvent::ChildAdded) { |
| 333 | QObject* child = static_cast<QChildEvent*>(event)->child(); |
| 334 | if(qobject_cast<QWidget*>(child)) { |
| 335 | child->installEventFilter(this); |
| 336 | } |
| 337 | } else if (event->type() == QEvent::ChildRemoved) { |
| 338 | QObject* child = static_cast<QChildEvent*>(event)->child(); |
| 339 | if(qobject_cast<QWidget*>(child)) { |
| 340 | child->removeEventFilter(this); |
| 341 | } |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | if (event->type() == QEvent::Wheel) { |
| 346 | auto* const wheelEvent = static_cast<QWheelEvent*>(event); |
| 347 | if (d->m_zoomController && d->m_zoomController->handleWheelEvent(wheelEvent)) |
| 348 | return true; |
| 349 | } else if (event->type() == QEvent::MouseButtonPress) { |
| 350 | const auto button = static_cast<QMouseEvent*>(event)->button(); |
| 351 | switch (button) { |
| 352 | case Qt::MouseButton::ForwardButton: |
| 353 | emit browseForward(); |
| 354 | event->accept(); |
| 355 | return true; |
| 356 | case Qt::MouseButton::BackButton: |
| 357 | emit browseBack(); |
| 358 | event->accept(); |
| 359 | return true; |
| 360 | default: |
| 361 | break; |
| 362 | } |
| 363 | } |
| 364 | return QWidget::eventFilter(object, event); |
| 365 | } |
| 366 | |
| 367 | void StandardDocumentationView::contextMenuEvent(QContextMenuEvent* event) |
| 368 | { |
nothing calls this directly
no test coverage detected