[Qt] Request to add clipboard operation messages

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


Hi,

In order to implement LM_CLEAR, LM_CUT, LM_PASTE and LM_COPY under 
LCL/Qt is necessary to notify the widgetset when those actions occurs.

I could not find a native way of doing so. AFAIK using QObject::connect 
it should be notified after the method (slot? - i'm c++ noob) is 
executed and is necessary that the message be sent before the Text is 
changed. Also it would be good the possibility to filter the action, 
i.e, if filtered in event::Filter the action should not occur.

I come with the following idea (i tried to compile under unix but got 
errors while using qmake so could not create a patch)

-Add constants for custom events (>QEvent::User): QEventClear, 
QEventCut, QEventPaste, QEventCopy
-Create create descendants to QLineEdit and QTextEdit
-Override clear, cut, copy, paste methods for these descendants in those 
methods do (in pseudo code):

if not eventFilter(Self, QEventPaste/Clear/Cut/Copy) then
   inherited;

//maybe use QApplication.PostEvent instead of eventFilter?

-Return an instance of those descendants in QLine/TextEdit_create so the 
overloaded methods are used

As i said i dont program with c++ even could not build the qt wrapper, 
so maybe you can come with a better schema

Luiz




More information about the Qt mailing list