KJSEmbed::JSEventMapper

Search for usage in LXR

KJSEmbed::JSEventMapper Class Reference

#include <jseventmapper.h>

Public Member Functions

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 JSEventMappermapper ()
 

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:

var myQObject = new QObjectBinding(this);
myQObject.onMyCustomEvent = function () { //do stuff ;}

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.

Author
Richard Moore, rich@.nosp@m.kde..nosp@m.org
Ian Reinhart Geiser, geise.nosp@m.ri@k.nosp@m.de.or.nosp@m.g

Definition at line 49 of file jseventmapper.h.

Member Function Documentation

◆ addEvent()

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.

◆ findEventHandler()

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.

◆ findEventType()

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.

◆ isEventHandler()

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.

◆ mapper()

JSEventMapper * KJSEmbed::JSEventMapper::mapper ( )
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:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Nov 29 2023 04:01:06 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.