kjsembed
#include <jseventmapper.h>
Public Member Functions | |
virtual | ~JSEventMapper () |
void | addEvent (const KJS::Identifier &name, QEvent::Type t) |
KJS::Identifier | findEventHandler (QEvent::Type t) const |
QEvent::Type | findEventType (const KJS::Identifier &name) const |
bool | isEventHandler (const KJS::Identifier &name) const |
Static Public Member Functions | |
static JSEventMapper * | mapper () |
Detailed Description
Maintains a map between the types of QEvent and the names of their event handlers.
This class handles all of the built in Qt events. To add your own custom events you can simply call mapper()->addEvent(KJS::Identifier("onMyCustomEvent"), QEvent::User + 1). Then in your javascript you can just do the following:
In cases where you need to handle properties on your custom event, you will need to provide a binding to that event and KJSEmbed will create an instance of it for you as the argument in your event handler.
Definition at line 49 of file jseventmapper.h.
Constructor & Destructor Documentation
|
virtual |
Definition at line 259 of file jseventmapper.cpp.
Member Function Documentation
void KJSEmbed::JSEventMapper::addEvent | ( | const KJS::Identifier & | name, |
QEvent::Type | t | ||
) |
Adds an event to the map.
The event handler has the specified name, and the event has the specified type.
Definition at line 263 of file jseventmapper.cpp.
KJS::Identifier KJSEmbed::JSEventMapper::findEventHandler | ( | QEvent::Type | t | ) | const |
Returns the name of the handler method for the specified event type.
Definition at line 279 of file jseventmapper.cpp.
QEvent::Type KJSEmbed::JSEventMapper::findEventType | ( | const KJS::Identifier & | name | ) | const |
Returns the type of the events handled by the specified handler.
Definition at line 269 of file jseventmapper.cpp.
bool KJSEmbed::JSEventMapper::isEventHandler | ( | const KJS::Identifier & | name | ) | const |
Returns true iff the specified name is the identifier for an event handler.
Definition at line 274 of file jseventmapper.cpp.
|
static |
Return the global event mapper.
Definition at line 284 of file jseventmapper.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:53 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.