Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all
Unified · Split
| @@ -434,16 +434,16 @@ void ScriptEngine::addEventHandler(const EntityItemID& entityID, const QString& · 433 unmodified lines | |||
| 434 | }); | 434 | }); |
| 435 | 435 | ||
| 436 | // Two common cases of event handler, differing only in argument signature. | 436 | // Two common cases of event handler, differing only in argument signature. |
| 437 | auto makeSingleEntityHandler = [=](const QString& eventName) { | 437 | auto makeSingleEntityHandler = [=](const QString& eventName) -> std::function<void(const EntityItemID&)> { |
| 438 | return [=](const EntityItemID& entityItemID) { | 438 | return [=](const EntityItemID& entityItemID) -> void { |
| 439 | generalHandler(entityItemID, eventName, [=]() { | 439 | generalHandler(entityItemID, eventName, [=]() -> QScriptValueList { |
| 440 | return QScriptValueList() << entityItemID.toScriptValue(this); | 440 | return QScriptValueList() << entityItemID.toScriptValue(this); |
| 441 | }); | 441 | }); |
| 442 | }; | 442 | }; |
| 443 | }; | 443 | }; |
| 444 | auto makeMouseHandler = [=](const QString& eventName) { | 444 | auto makeMouseHandler = [=](const QString& eventName) -> std::function<void(const EntityItemID&, const MouseEvent&)> { |
| 445 | return [=](const EntityItemID& entityItemID, const MouseEvent& event) { | 445 | return [=](const EntityItemID& entityItemID, const MouseEvent& event) -> void { |
| 446 | generalHandler(entityItemID, eventName, [=]() { | 446 | generalHandler(entityItemID, eventName, [=]() -> QScriptValueList { |
| 447 | return QScriptValueList() << entityItemID.toScriptValue(this) << event.toScriptValue(this); | 447 | return QScriptValueList() << entityItemID.toScriptValue(this) << event.toScriptValue(this); |
| 448 | }); | 448 | }); |
| 449 | }; | 449 | }; |