[Gui] TextEdit, zoom on Ctrl + wheel

Fixes #13861
This commit is contained in:
Benjamin Bræstrup Sayoc
2024-10-06 20:45:49 +02:00
committed by Yorik van Havre
parent ecaa200ad2
commit 5b3ab4759d
2 changed files with 12 additions and 0 deletions

View File

@@ -96,6 +96,17 @@ void TextEdit::keyPressEvent(QKeyEvent* e)
}
}
void TextEdit::wheelEvent(QWheelEvent* e)
{
// Reimplement from QPlainText::wheelEvent as zoom is only allowed natively if !isReadOnly
if (e->modifiers() & Qt::ControlModifier) {
float delta = e->angleDelta().y() / 120.f;
zoomInF(delta);
return;
}
QPlainTextEdit::wheelEvent(e);
}
/**
* Completes the word.
*/

View File

@@ -70,6 +70,7 @@ Q_SIGNALS:
protected:
void keyPressEvent(QKeyEvent *) override;
void wheelEvent(QWheelEvent* e) override;
private:
void createListBox();