PDA

View Full Version : QPlainTextEdit Disable zoom in/out



tvj4218
6th July 2017, 21:57
I've got a QPlainTextEdit widget with some text in it. When the user uses ctrl + mouse wheel, the text changes the size.

i'd like to disable this behavior. Is there a way to do that?

Currently the widget is set as read only.

n

d_stranz
7th July 2017, 22:02
My guess is that QPlainTextEdit::wheelEvent() is where the zoom in / out originates. It you derive a new class from QPlainTextEdit and override this method, you can prevent the zooming. When ctrl is pressed, you call accept() on the event, otherwise you call the base class method to let the normal handling occur (such as scroll up / down).