Results 1 to 2 of 2

Thread: QPlainTextEdit Disable zoom in/out

  1. #1
    Join Date
    Dec 2016
    Posts
    37
    Qt products
    Qt5
    Platforms
    Windows

    Default QPlainTextEdit Disable zoom in/out

    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

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QPlainTextEdit Disable zoom in/out

    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).
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 0
    Last Post: 6th June 2016, 08:35
  2. Replies: 0
    Last Post: 20th April 2015, 21:03
  3. Disable auto-scrolling in QPlainTextEdit
    By lukass in forum Newbie
    Replies: 2
    Last Post: 21st February 2011, 10:31
  4. QWTPlot Zoom: cannot zoom negative value
    By jwieland in forum Qwt
    Replies: 0
    Last Post: 8th January 2010, 16:16
  5. Enable/Disable Zoom with a checkable action
    By yannwilfried in forum Qwt
    Replies: 2
    Last Post: 2nd December 2009, 15:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.