说起QT,如雷贯耳,但正面接触却是最近的事情了,万事开头,就从QT的Event开始吧:
>> QT中,事件的处理有5个层次:
-----------------------------------------------------------------
>> Reimplementing a specific event handler.
QObject and QWidget provide
many specific event handlers for different types of events (for example, paintEvent()
for paint events).
说白了就是覆盖事件处理的虚函数,类似于MFC中OnDraw/OnMouseMove之类的。
>> Reimplementing QObject::event().
The event()
function is the entry point for all of an object's events. The default
implementations in QObject and QWidget simply forward the
events to the specific event handlers.
这玩意儿似乎与PreTranslateMessage有得一比。
>> Installing an event filter on a QObject.
An event
filter is an object that receives another object's events before they
reach the intended target.
其实在Win32 Programming中有一个窗口子类化也是很不错,也可以将某窗口的事件交给自定义的窗口过程来处理时间。
事实上,Qt之类对Windows Control事件的监视就是用的这个办法,通过统一的回调函数来分发事件。
http://www.cnblogs.com/smoozer/archive/2009/02/09/1386704.html
>> Installing an event filter on qApp.
>> Reimplementing QApplication::notify().
------------------------------------------------------------------
http://doc.qt.nokia.com/4.2/eventsandfilters.html
>> 自定义事件
在QT3,自定义事件必须从QCustomEvent继承。而在QT4中,则只需从QEvent继承,覆盖customEvent方法可以处理自定义事件。
Asynch的情况下要使用PostMessage,而Synch情况下则要用SendMessage
>>postEvent/sentEvent
与SendMessage与PostMessage差不多,二者的差别亦是如此。
>> Signal/Slot
不懂,以后再说