Ladybird: Add initial support for Ctrl+Scroll to zoom in/out

This commit adds basic functionality to zoom in/out using the
Ctrl+Scroll shortcut.
This commit is contained in:
Zack Penn 2023-06-30 17:33:04 -05:00 committed by Andreas Kling
parent 6b649af447
commit 5775993a2a
2 changed files with 11 additions and 0 deletions

View file

@ -662,6 +662,16 @@ void BrowserWindow::moveEvent(QMoveEvent* event)
}
}
void BrowserWindow::wheelEvent(QWheelEvent* event)
{
if ((event->modifiers() & Qt::ControlModifier) != 0) {
if (event->angleDelta().y() > 0)
zoom_in();
else if (event->angleDelta().y() < 0)
zoom_out();
}
}
bool BrowserWindow::eventFilter(QObject* obj, QEvent* event)
{
if (event->type() == QEvent::MouseButtonRelease) {

View file

@ -92,6 +92,7 @@ protected:
private:
virtual void resizeEvent(QResizeEvent*) override;
virtual void moveEvent(QMoveEvent*) override;
virtual void wheelEvent(QWheelEvent*) override;
void debug_request(DeprecatedString const& request, DeprecatedString const& argument = "");