Results 1 to 7 of 7

Thread: How to disable shortcuts in QTextEdit

  1. #1
    Join Date
    Feb 2013
    Posts
    28
    Thanks
    13
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default How to disable shortcuts in QTextEdit

    Hi
    I'm working in a scientific calculator project using Qt5, I'm using the QTextEdit as the calculator's display.
    I want to disable the shortcuts like (Ctrl + A, and Ctrl + C) in the display, so How can I do that?
    Thank you.

  2. #2
    Join Date
    Jul 2011
    Location
    Pune, India
    Posts
    21
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to disable shortcuts in QTextEdit

    Quote Originally Posted by Baso View Post
    I want to disable the shortcuts like (Ctrl + A, and Ctrl + C) in the display, so How can I do that?
    Thank you.
    When your textedit has a focus, try to implement what we call "Event Filters".
    Filtered out events have no effects.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to disable shortcuts in QTextEdit

    Quote Originally Posted by ommharidaas View Post
    When your textedit has a focus, try to implement what we call "Event Filters".
    Filtered out events have no effects.
    It is not going to prevent opening the context menu and choosing those actions from within there.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Feb 2013
    Posts
    28
    Thanks
    13
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: How to disable shortcuts in QTextEdit

    @ommharidaas!, Would you please give me a link or tell me how to deal with that "Event Filters".

    @Wysota!, I've already disabled context menu, all I need is to disable the shortcuts

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to disable shortcuts in QTextEdit

    Quote Originally Posted by Baso View Post
    @Wysota!, I've already disabled context menu, all I need is to disable the shortcuts
    And how exactly did you do that?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Feb 2013
    Posts
    28
    Thanks
    13
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: How to disable shortcuts in QTextEdit

    Quote Originally Posted by wysota View Post
    And how exactly did you do that?
    Qt Code:
    1. texteditor->setContextMenuPolicy(Qt::NoContextMenu);
    To copy to clipboard, switch view to plain text mode 

  7. #7
    Join Date
    Jul 2011
    Location
    Pune, India
    Posts
    21
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to disable shortcuts in QTextEdit

    Hi Baso,
    Try looking up this.
    http://qt-project.org/forums/viewthread/14802

  8. The following user says thank you to ommharidaas for this useful post:


Similar Threads

  1. Replies: 0
    Last Post: 19th December 2012, 21:23
  2. QTextEdit - disable paste()
    By PePeL in forum Qt Programming
    Replies: 3
    Last Post: 23rd December 2011, 07:51
  3. How to disable the shortCuts in QGraphicsWebView
    By fzhu in forum Qt Programming
    Replies: 0
    Last Post: 15th October 2010, 07:37
  4. Pb with shortcuts on Mac OS
    By mourad in forum Qt Programming
    Replies: 1
    Last Post: 22nd May 2008, 19:22
  5. Disable Return on QTextEdit
    By raphaelf in forum Newbie
    Replies: 3
    Last Post: 23rd May 2007, 08:04

Tags for this Thread

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.