diff --git a/scriptengines/javascript/simplebindings/qscriptbookkeeping.cpp b/scriptengines/javascript/simplebindings/qscriptbookkeeping.cpp index 5c0360000..a4c7b2b00 100644 --- a/scriptengines/javascript/simplebindings/qscriptbookkeeping.cpp +++ b/scriptengines/javascript/simplebindings/qscriptbookkeeping.cpp @@ -43,6 +43,7 @@ Q_DECLARE_METATYPE(Plasma::Applet*) Q_DECLARE_METATYPE(Plasma::Extender*) Q_DECLARE_METATYPE(Plasma::VideoWidget::Controls) Q_DECLARE_METATYPE(Plasma::Svg*) +Q_DECLARE_METATYPE(Qt::MouseButton) Q_DECLARE_METATYPE(AppletInterface*) @@ -198,6 +199,16 @@ void extenderFromQScriptValue(const QScriptValue &scriptValue, ExtenderPtr &exte extender = static_cast(obj); } +QScriptValue qScriptValueFromMouseButton(QScriptEngine *engine, const Qt::MouseButton &button) +{ + return int(button); +} + +void mouseButtonFromScriptValue(const QScriptValue &scriptValue, Qt::MouseButton &button) +{ + button = static_cast(scriptValue.toInt32()); +} + using namespace Plasma; void registerSimpleAppletMetaTypes(QScriptEngine *engine) @@ -212,7 +223,7 @@ void registerSimpleAppletMetaTypes(QScriptEngine *engine) qScriptRegisterMetaType(engine, qScriptValueFromAnimation, abstractAnimationFromQScriptValue); qScriptRegisterMetaType(engine, qScriptValueFromExtender, extenderFromQScriptValue); qScriptRegisterMetaType(engine, qScriptValueFromControls, controlsFromScriptValue, QScriptValue()); - + qScriptRegisterMetaType(engine, qScriptValueFromMouseButton, mouseButtonFromScriptValue); registerDataEngineMetaTypes(engine); }