diff options
Diffstat (limited to 'doc/html/eventsandfilters.html')
-rw-r--r-- | doc/html/eventsandfilters.html | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/doc/html/eventsandfilters.html b/doc/html/eventsandfilters.html index 9b3480656..b4e0729e1 100644 --- a/doc/html/eventsandfilters.html +++ b/doc/html/eventsandfilters.html @@ -33,12 +33,12 @@ body { background: #ffffff; color: black; } -<p> In TQt, an event is an object that inherits <a href="qevent.html">TQEvent</a>. Events are -delivered to objects that inherit <a href="qobject.html">TQObject</a> through calling <a href="qobject.html#event">TQObject::event</a>(). Event delivery means that an event has occurred, the -<a href="qevent.html">TQEvent</a> indicates precisely what, and the <a href="qobject.html">TQObject</a> needs to respond. Most -events are specific to <a href="qwidget.html">TQWidget</a> and its subclasses, but there are +<p> In TQt, an event is an object that inherits <a href="ntqevent.html">TQEvent</a>. Events are +delivered to objects that inherit <a href="ntqobject.html">TQObject</a> through calling <a href="ntqobject.html#event">TQObject::event</a>(). Event delivery means that an event has occurred, the +<a href="ntqevent.html">TQEvent</a> indicates precisely what, and the <a href="ntqobject.html">TQObject</a> needs to respond. Most +events are specific to <a href="ntqwidget.html">TQWidget</a> and its subclasses, but there are important events that aren't related to graphics, for example, socket -activation, which is the event used by <a href="qsocketnotifier.html">TQSocketNotifier</a> for its +activation, which is the event used by <a href="ntqsocketnotifier.html">TQSocketNotifier</a> for its work. <p> Some events come from the window system, e.g. <a href="qmouseevent.html">TQMouseEvent</a>, some from other sources, e.g. <a href="qtimerevent.html">TQTimerEvent</a>, and some come from the @@ -47,17 +47,17 @@ events in exactly the same ways as TQt's own event loop does. <p> Most events types have special classes, most commonly <a href="qresizeevent.html">TQResizeEvent</a>, <a href="qpaintevent.html">TQPaintEvent</a>, <a href="qmouseevent.html">TQMouseEvent</a>, <a href="qkeyevent.html">TQKeyEvent</a> and <a href="qcloseevent.html">TQCloseEvent</a>. There are many others, perhaps forty or so, but most are rather odd. -<p> Each class subclasses <a href="qevent.html">TQEvent</a> and adds event-specific functions; see, +<p> Each class subclasses <a href="ntqevent.html">TQEvent</a> and adds event-specific functions; see, for example, <a href="qresizeevent.html">TQResizeEvent</a>. In the case of <a href="qresizeevent.html">TQResizeEvent</a>, <a href="qresizeevent.html#size">TQResizeEvent::size</a>() and <a href="qresizeevent.html#oldSize">TQResizeEvent::oldSize</a>() are added. <p> Some classes support more than one event type. <a href="qmouseevent.html">TQMouseEvent</a> supports mouse moves, presses, shift-presses, drags, clicks, right-presses, etc. <p> Since programs need to react in varied and complex ways, TQt's event delivery mechanisms are flexible. The documentation for -<a href="qapplication.html#notify">TQApplication::notify</a>() concisely tells the whole story, here we +<a href="ntqapplication.html#notify">TQApplication::notify</a>() concisely tells the whole story, here we will explain enough for 99% of applications. <p> The normal way for an event to be delivered is by calling a virtual -function. For example, <a href="qpaintevent.html">TQPaintEvent</a> is delivered by calling <a href="qwidget.html#paintEvent">TQWidget::paintEvent</a>(). This virtual function is responsible for +function. For example, <a href="qpaintevent.html">TQPaintEvent</a> is delivered by calling <a href="ntqwidget.html#paintEvent">TQWidget::paintEvent</a>(). This virtual function is responsible for reacting appropriately, normally by repainting the widget. If you do not perform all the necessary work in your implementation of the virtual function, you may need to call the base class's @@ -67,7 +67,7 @@ implementation; for example: { // my implementation - TQTable::<a href="qscrollview.html#contentsMouseMoveEvent">contentsMouseMoveEvent</a>( me ); // hand it on + TQTable::<a href="ntqscrollview.html#contentsMouseMoveEvent">contentsMouseMoveEvent</a>( me ); // hand it on } </pre> @@ -77,23 +77,23 @@ class's functionality, then you implement what you want and then call the base class. <p> Occasionally there isn't such an event-specific function, or the event-specific function isn't sufficient. The most common example is -tab key presses. Normally, those are interpreted by <a href="qwidget.html">TQWidget</a> to move +tab key presses. Normally, those are interpreted by <a href="ntqwidget.html">TQWidget</a> to move the <a href="focus.html#keyboard-focus">keyboard focus</a>, but a few widgets need the tab key for themselves. -<p> These objects can reimplement <a href="qobject.html#event">TQObject::event</a>(), the general event +<p> These objects can reimplement <a href="ntqobject.html#event">TQObject::event</a>(), the general event handler, and either do their event handling before or after the usual handling, or replace it completely. A very unusual widget that both interprets tab and has an application-specific custom event might contain: <p> <pre> - bool MyClass:event( <a href="qevent.html">TQEvent</a> *evt ) { - if ( evt-><a href="qevent.html#type">type</a>() == TQEvent::KeyPress ) { + bool MyClass:event( <a href="ntqevent.html">TQEvent</a> *evt ) { + if ( evt-><a href="ntqevent.html#type">type</a>() == TQEvent::KeyPress ) { <a href="qkeyevent.html">TQKeyEvent</a> *ke = (TQKeyEvent *)evt; if ( ke-><a href="qkeyevent.html#key">key</a>() == Key_Tab ) { // special tab handling here ke-><a href="qkeyevent.html#accept">accept</a>(); return TRUE; } - } else if ( evt-><a href="qevent.html#type">type</a>() >= TQEvent::User ) { + } else if ( evt-><a href="ntqevent.html#type">type</a>() >= TQEvent::User ) { <a href="qcustomevent.html">TQCustomEvent</a> *ce = (TQCustomEvent*) evt; // custom event handling here return TRUE; @@ -103,25 +103,25 @@ contain: </pre> <p> More commonly, an object needs to look at another's events. TQt -supports this using <a href="qobject.html#installEventFilter">TQObject::installEventFilter</a>() (and the +supports this using <a href="ntqobject.html#installEventFilter">TQObject::installEventFilter</a>() (and the corresponding remove). For example, dialogs commonly want to filter key presses for some widgets, e.g. to modify Return-key handling. <p> An event filter gets to process events before the target object does. -The filter's <a href="qobject.html#eventFilter">TQObject::eventFilter</a>() implementation is called, and +The filter's <a href="ntqobject.html#eventFilter">TQObject::eventFilter</a>() implementation is called, and can accept or reject the filter, and allow or deny further processing of the event. If all the event filters allow further processing of an event, the event is sent to the target object itself. If one of them stops processing, the target and any later event filters don't get to see the event at all. <p> It's also possible to filter <em>all</em> events for the entire application, -by installing an event filter on <a href="qapplication.html">TQApplication</a>. This is what <a href="qtooltip.html">TQToolTip</a> does in order to see <em>all</em> the mouse and keyboard activity. +by installing an event filter on <a href="ntqapplication.html">TQApplication</a>. This is what <a href="ntqtooltip.html">TQToolTip</a> does in order to see <em>all</em> the mouse and keyboard activity. This is very powerful, but it also slows down event delivery of every single event in the entire application, so it's best avoided. <p> The global event filters are called before the object-specific filters. <p> Finally, many applications want to create and send their own events. <p> Creating an event of a built-in type is very simple: create an object -of the relevant type, and then call <a href="qapplication.html#sendEvent">TQApplication::sendEvent</a>() or <a href="qapplication.html#postEvent">TQApplication::postEvent</a>(). +of the relevant type, and then call <a href="ntqapplication.html#sendEvent">TQApplication::sendEvent</a>() or <a href="ntqapplication.html#postEvent">TQApplication::postEvent</a>(). <p> sendEvent() processes the event immediately - when sendEvent() returns, (the event filters and) the object have already processed the event. For many event classes there is a function called isAccepted() @@ -130,13 +130,13 @@ handler that was called. <p> postEvent() posts the event on a queue for later dispatch. The next time TQt's main event loop runs, it dispatches all posted events, with some optimization. For example, if there are several resize events, -they are are compacted into one. The same applies to paint events: <a href="qwidget.html#update">TQWidget::update</a>() calls postEvent(), which minimizes flickering and +they are are compacted into one. The same applies to paint events: <a href="ntqwidget.html#update">TQWidget::update</a>() calls postEvent(), which minimizes flickering and increases speed by avoiding multiple repaints. <p> postEvent() is also often used during object initialization, since the posted event will typically be dispatched very soon after the initialization of the object is complete. <p> To create events of a custom type, you need to define an event number, -which must be greater than <a href="qevent.html#Type-enum">TQEvent::User</a>, and probably you also need +which must be greater than <a href="ntqevent.html#Type-enum">TQEvent::User</a>, and probably you also need to subclass <a href="qcustomevent.html">TQCustomEvent</a> in order to pass characteristics about your custom event. See the documentation to <a href="qcustomevent.html">TQCustomEvent</a> for details. |