Register non-gui types properly for declarative applets
It was not previously possible to use KConfig etc. from declarative applets, because the relevant qScriptRegisterMetaType functions were not called. This fixes that by calling registerNonGuiMetaTypes from registerSimpleAppletMetaTypes.
This commit is contained in:
parent
b529412312
commit
7737bb48ba
@ -93,7 +93,6 @@ QScriptValue constructQRectFClass(QScriptEngine *engine);
|
||||
QScriptValue constructQSizeFClass(QScriptEngine *engine);
|
||||
QScriptValue constructQSizePolicyClass(QScriptEngine *engine);
|
||||
QScriptValue constructTimerClass(QScriptEngine *engine);
|
||||
void registerNonGuiMetaTypes(QScriptEngine *engine);
|
||||
void registerSimpleAppletMetaTypes(QScriptEngine *engine);
|
||||
|
||||
KSharedPtr<UiLoader> SimpleJavaScriptApplet::s_widgetLoader;
|
||||
@ -581,7 +580,6 @@ void SimpleJavaScriptApplet::setupObjects()
|
||||
global.setProperty("FrameSvg", m_engine->newFunction(SimpleJavaScriptApplet::newPlasmaFrameSvg));
|
||||
global.setProperty("ExtenderItem", m_engine->newFunction(SimpleJavaScriptApplet::newPlasmaExtenderItem));
|
||||
|
||||
registerNonGuiMetaTypes(m_engine);
|
||||
registerSimpleAppletMetaTypes(m_engine);
|
||||
installWidgets(m_engine);
|
||||
}
|
||||
|
@ -127,10 +127,13 @@ void mouseButtonFromScriptValue(const QScriptValue &scriptValue, Qt::MouseButton
|
||||
button = static_cast<Qt::MouseButton>(scriptValue.toInt32());
|
||||
}
|
||||
|
||||
#include "simplebindings/qscriptnonguibookkeeping.cpp"
|
||||
|
||||
using namespace Plasma;
|
||||
|
||||
void registerSimpleAppletMetaTypes(QScriptEngine *engine)
|
||||
{
|
||||
registerNonGuiMetaTypes(engine);
|
||||
qScriptRegisterMetaType<QGraphicsWidget*>(engine, qScriptValueFromQGraphicsWidget, graphicsWidgetFromQScriptValue);
|
||||
qScriptRegisterMetaType<Plasma::Svg*>(engine, qScriptValueFromSvg, svgFromQScriptValue);
|
||||
|
||||
@ -141,5 +144,4 @@ void registerSimpleAppletMetaTypes(QScriptEngine *engine)
|
||||
qScriptRegisterMetaType<Qt::MouseButton>(engine, qScriptValueFromMouseButton, mouseButtonFromScriptValue);
|
||||
}
|
||||
|
||||
#include "simplebindings/qscriptnonguibookkeeping.cpp"
|
||||
|
||||
|
@ -100,7 +100,7 @@ using namespace Plasma;
|
||||
|
||||
void registerNonGuiMetaTypes(QScriptEngine *engine)
|
||||
{
|
||||
qScriptRegisterMetaType<KConfigGroup>(engine, qScriptValueFromKConfigGroup, kConfigGroupFromScriptValue, QScriptValue());
|
||||
qScriptRegisterMetaType<KConfigGroup>(engine, qScriptValueFromKConfigGroup, kConfigGroupFromScriptValue);
|
||||
qScriptRegisterMetaType<KJob *>(engine, qScriptValueFromKJob, qKJobFromQScriptValue);
|
||||
qScriptRegisterMetaType<KIO::Job *>(engine, qScriptValueFromKIOJob, qKIOJobFromQScriptValue);
|
||||
registerDataEngineMetaTypes(engine);
|
||||
|
Loading…
Reference in New Issue
Block a user