Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 5 files). Show all
Unified · Split
| @@ -404,7 +404,7 @@ void ScriptEngine::generalHandler(const EntityItemID& entityID, const QString& e · 403 unmodified lines | |||
| 404 | } | 404 | } |
| 405 | } | 405 | } |
| 406 | // Unregister the handlers for this eventName and entityID. | 406 | // Unregister the handlers for this eventName and entityID. |
| 407 | void ScriptEngine::removeEntityEventHandler(const EntityItemID& entityID, const QString& eventName, QScriptValue handler) { | 407 | void ScriptEngine::removeEventHandler(const EntityItemID& entityID, const QString& eventName, QScriptValue handler) { |
| 408 | if (!_registeredHandlers.contains(entityID)) return; | 408 | if (!_registeredHandlers.contains(entityID)) return; |
| 409 | RegisteredEventHandlers& handlersOnEntity = _registeredHandlers[entityID]; | 409 | RegisteredEventHandlers& handlersOnEntity = _registeredHandlers[entityID]; |
| 410 | QScriptValueList& handlersForEvent = handlersOnEntity[eventName]; | 410 | QScriptValueList& handlersForEvent = handlersOnEntity[eventName]; |
| @@ -417,7 +417,7 @@ void ScriptEngine::removeEntityEventHandler(const EntityItemID& entityID, const · 6 unmodified lines | |||
| 417 | } | 417 | } |
| 418 | } | 418 | } |
| 419 | // Register the handler. | 419 | // Register the handler. |
| 420 | void ScriptEngine::addEntityEventHandler(const EntityItemID& entityID, const QString& eventName, QScriptValue handler) { | 420 | void ScriptEngine::addEventHandler(const EntityItemID& entityID, const QString& eventName, QScriptValue handler) { |
| 421 | if (_registeredHandlers.count() == 0) { // First time any per-entity handler has been added in this script... | 421 | if (_registeredHandlers.count() == 0) { // First time any per-entity handler has been added in this script... |
| 422 | // Connect up ALL the handlers to the global entities object's signals. | 422 | // Connect up ALL the handlers to the global entities object's signals. |
| 423 | // (We could go signal by signal, or even handler by handler, but I don't think the efficiency is worth the complexity.) | 423 | // (We could go signal by signal, or even handler by handler, but I don't think the efficiency is worth the complexity.) |