[Qt] Request to add clipboard operation messages

zeljko zeljko at holobit.net
Thu Oct 13 15:38:10 CEST 2011


On Thursday 13 of October 2011 15:17:09 Luiz Americo Pereira Camara wrote:
> 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.

No, that cannot work. You cannot override C++ class in pascal, for your needs 
we need overrided QLineEdit in QtPas4 C library (eg. QLCLLineEdit), but I'm 
against it.Also another problem raises with QLineEdit members of 
QComboBOx,QSpinBox and others, all of them must be overrided with QLCLLineEdit 
in that case.

As I said, I'll try to intercept actions (since there it can be stopped), if 
that won't work then we must change bindings.

zeljko


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/qt/attachments/20111013/56455a21/attachment-0002.html>


More information about the Qt mailing list