Commit 2082cfcb authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

[Workspace Scripting] Turn "gridUnit" into a property getter function

Avoids calling into QFontMetrics on startup for a method that is hardly used.

Differential Revision: https://phabricator.kde.org/D12173
parent 8f1d3d65
......@@ -170,7 +170,7 @@ void ScriptEngine::setupEngine()
m_scriptSelf.setProperty(QStringLiteral("applicationPath"), newFunction(ScriptEngine::V1::applicationPath));
m_scriptSelf.setProperty(QStringLiteral("knownWallpaperPlugins"), newFunction(ScriptEngine::V1::knownWallpaperPlugins));
m_scriptSelf.setProperty(QStringLiteral("ConfigFile"), newFunction(ScriptEngine::V1::configFile));
m_scriptSelf.setProperty(QStringLiteral("gridUnit"), ScriptEngine::V1::gridUnit());
m_scriptSelf.setProperty(QStringLiteral("gridUnit"), newFunction(ScriptEngine::V1::gridUnit), QScriptValue::PropertyGetter);
m_scriptSelf.setProperty(QStringLiteral("setImmutability"), newFunction(ScriptEngine::V1::setImmutability));
m_scriptSelf.setProperty(QStringLiteral("immutability"), newFunction(ScriptEngine::V1::immutability));
......
......@@ -917,8 +917,10 @@ QScriptValue ScriptEngine::V1::desktops(QScriptContext *context,
return containments;
}
QScriptValue ScriptEngine::V1::gridUnit()
QScriptValue ScriptEngine::V1::gridUnit(QScriptContext *context, QScriptEngine *engine)
{
Q_UNUSED(context);
Q_UNUSED(engine);
return ScriptEngine::gridUnit();
}
......
......@@ -57,7 +57,7 @@ public:
static QScriptValue userDataPath(QScriptContext *context, QScriptEngine *engine);
static QScriptValue knownWallpaperPlugins(QScriptContext *context, QScriptEngine *engine);
static QScriptValue configFile(QScriptContext *context, QScriptEngine *engine);
static QScriptValue gridUnit();
static QScriptValue gridUnit(QScriptContext *context, QScriptEngine *engine);
static QScriptValue createContainment(const QString &type, const QString &defautPlugin,
QScriptContext *context, QScriptEngine *engine);
static QScriptValue setImmutability(QScriptContext *context, QScriptEngine *engine);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment