PDA

View Full Version : How to disable shortcuts in QTextEdit



Baso
10th February 2013, 21:13
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.

ommharidaas
11th February 2013, 08:52
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.

wysota
11th February 2013, 08:59
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.

Baso
11th February 2013, 17:54
@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

wysota
11th February 2013, 18:41
@Wysota!, I've already disabled context menu, all I need is to disable the shortcuts

And how exactly did you do that?

Baso
11th February 2013, 19:34
And how exactly did you do that?


texteditor->setContextMenuPolicy(Qt::NoContextMenu);

ommharidaas
15th May 2013, 12:55
Hi Baso,
Try looking up this.
http://qt-project.org/forums/viewthread/14802