[Qt] Request to add clipboard operation messages

Luiz Americo Pereira Camara luizmed at oi.com.br
Thu Oct 13 15:17:09 CEST 2011


On 13/10/2011 09:40, zeljko wrote:
>
> 2nd: you want to abort standard clipboard ops over text controls like 
> QLineEdit by intercepting widgetset ? If yes then I don't know level 
> of complications about this.
>
> Qt have default actions menu over such controls (QLineEdit, QTextEdit 
> .. and others where QLineEdit or QTextEdit are inherited, like 
> QComboBox, QSpinBox etc), so basically QEvent::Action/QEvent::Shortcut 
> have to be intercepted and stopped if LCL wants so ... but I'm not 
> sure if this will work ... must dig into qt code to see how is this 
> implemented.
>
[ sorry zeljko, somehow Thunderbird "Send to List" got confused]

It's not difficult nor requires much code, since Qt maps those actions 
to, e.g., QLineEdit:paste (i looked the callstack when context menu is 
used). Just do in c++ qt wrapper (pascalized code)

procedure QExLineEdit.paste; //override QLineEdit.paste
var
   AnEvent: QEvent;
begin
    AnEvent := QEvent.Create(QtPaste);
    if not eventFilter(self, AnEvent) then
       inherited paste;
end;


With this:
1) Qt WidgetSet will be notified before the text is changed
2) if the event is filtered no text is changed

If this does not work no need to more complicated trials. Only item 01 
is required.

Luiz





More information about the Qt mailing list