Delegate input events of HardwareRenderer to RendererStack

This commit is contained in:
Cacodemon345
2021-12-18 00:37:30 +06:00
parent cfbc9c22dc
commit 0313d02073
3 changed files with 23 additions and 17 deletions

View File

@@ -47,18 +47,21 @@ void HardwareRenderer::resizeEvent(QResizeEvent *event) {
QOpenGLWindow::resizeEvent(event);
}
void HardwareRenderer::mouseReleaseEvent(QMouseEvent *event)
bool HardwareRenderer::event(QEvent *event)
{
if (this->geometry().contains(event->pos()) && event->button() == Qt::LeftButton && !mouse_capture)
switch (event->type())
{
plat_mouse_capture(1);
this->setCursor(Qt::BlankCursor);
return;
default:
return QOpenGLWindow::event(event);
case QEvent::MouseButtonPress:
case QEvent::MouseMove:
case QEvent::MouseButtonRelease:
case QEvent::KeyPress:
case QEvent::KeyRelease:
case QEvent::Wheel:
case QEvent::Enter:
case QEvent::Leave:
return QApplication::sendEvent(parentWidget, event);
}
if (mouse_capture && event->button() == Qt::MiddleButton)
{
plat_mouse_capture(0);
this->setCursor(Qt::ArrowCursor);
return;
}
}
return false;
}