[Qt-interest] Need some help about QLineEdit

Zeljko zeljko at holobit.net
Sun Oct 16 14:54:19 CEST 2011


Andre Somers wrote:

> Op 16-10-2011 13:05, Zeljko schreef:
>> Andre Somers wrote:
>>
>>> Op 16-10-2011 11:06, Zeljko schreef:
>>>> Hi,
>>>> As I can see there's no way to catch copy(),paste() and cut() ops with any
>>>> event/signal ?
>>>> I need to intercept those to know when user copied , pasted and
>>>> cutted data from QLineEdit and QTextEdit and eventually forbid operation.
>>>> I know that QValidator helps in case of paste() , but what about copy() and
>>>> cut() ?
>>>> Is there any solution (or even planned in 5.0) for such problem (of course
>>>> there's + selection copy under X11 ...) ?
>>>>
>>> You should try an event filter, and filter out the key events.
>> I can do that for user input events eg. pressed Ctrl +C , but what about
>> context menu actions ? When user triggers copy() via context menu (default
>> one) there's no events in event filter that shortcut triggered (Ctrl + C) or
>> anything similar.
>>
> You can show your own context menu, right? You can listen to the
> contextMenuEvent, or use the QWidget::contextMenuPolicy to change if and
> how a context menu is shown.

Of course I can do that, but asked because of another possibility ... seem 
there's nothing except intercept keys and build my own context menu.

zeljko



More information about the Qt-interest-old mailing list