diff options
author | Robin Burchell <robin.burchell@theqtcompany.com> | 2015-03-10 13:29:27 +0100 |
---|---|---|
committer | Robin Burchell <robin.burchell@viroteck.net> | 2015-03-12 10:26:00 +0000 |
commit | 2cf54e48922a7d379fb7e212966d05bc402e475d (patch) | |
tree | a7668dbe5cfa7f58a87a9fc256f2ff8870891f5e /src/webengine | |
parent | d3905d85925a950ca32aa78eead6db7228be1330 (diff) |
UserScript: Rename source property to sourceCode.
The name 'source' is unclear, and doesn't match current conventions in QtQuick
(e.g. Image::source). Furthermore, such a property inhibits adding convenience
API to fetch a user script from an external URI.
Change-Id: I518b3963f64f0986f9e2d08fe7c5f69122372e0c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/webengine')
-rw-r--r-- | src/webengine/api/qquickwebenginescript.cpp | 15 | ||||
-rw-r--r-- | src/webengine/api/qquickwebenginescript_p.h | 8 |
2 files changed, 11 insertions, 12 deletions
diff --git a/src/webengine/api/qquickwebenginescript.cpp b/src/webengine/api/qquickwebenginescript.cpp index 8d42d77a3..6ea6d01bc 100644 --- a/src/webengine/api/qquickwebenginescript.cpp +++ b/src/webengine/api/qquickwebenginescript.cpp @@ -72,7 +72,7 @@ QString QQuickWebEngineScript::toString() const } ret.append(QString::number(d->coreScript.worldId()) % QStringLiteral(", ") % (d->coreScript.runsOnSubFrames() ? QStringLiteral("true") : QStringLiteral("false")) - % QStringLiteral(", ") % d->coreScript.source() % QLatin1Char(')')); + % QStringLiteral(", ") % d->coreScript.sourceCode() % QLatin1Char(')')); return ret; } @@ -83,10 +83,10 @@ QString QQuickWebEngineScript::name() const } -QString QQuickWebEngineScript::source() const +QString QQuickWebEngineScript::sourceCode() const { Q_D(const QQuickWebEngineScript); - return d->coreScript.source(); + return d->coreScript.sourceCode(); } ASSERT_ENUMS_MATCH(QQuickWebEngineScript::Deferred, UserScript::AfterLoad) @@ -124,17 +124,16 @@ void QQuickWebEngineScript::setName(QString arg) Q_EMIT nameChanged(arg); } -void QQuickWebEngineScript::setSource(QString arg) +void QQuickWebEngineScript::setSourceCode(QString arg) { Q_D(QQuickWebEngineScript); - if (arg == source()) + if (arg == sourceCode()) return; d->aboutToUpdateUnderlyingScript(); - d->coreScript.setSource(arg); - Q_EMIT sourceChanged(arg); + d->coreScript.setSourceCode(arg); + Q_EMIT sourceCodeChanged(arg); } - void QQuickWebEngineScript::setInjectionPoint(QQuickWebEngineScript::InjectionPoint arg) { Q_D(QQuickWebEngineScript); diff --git a/src/webengine/api/qquickwebenginescript_p.h b/src/webengine/api/qquickwebenginescript_p.h index 4992105fa..55f0c782d 100644 --- a/src/webengine/api/qquickwebenginescript_p.h +++ b/src/webengine/api/qquickwebenginescript_p.h @@ -50,7 +50,7 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineScript : public QObject Q_ENUMS(InjectionPoint) Q_ENUMS(ScriptWorldId) Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceChanged) + Q_PROPERTY(QString sourceCode READ sourceCode WRITE setSourceCode NOTIFY sourceCodeChanged) Q_PROPERTY(InjectionPoint injectionPoint READ injectionPoint WRITE setInjectionPoint NOTIFY injectionPointChanged) Q_PROPERTY(ScriptWorldId worldId READ worldId WRITE setWorldId NOTIFY worldIdChanged) Q_PROPERTY(bool runOnSubframes READ runOnSubframes WRITE setRunOnSubframes NOTIFY runOnSubframesChanged) @@ -74,21 +74,21 @@ public: Q_INVOKABLE QString toString() const; QString name() const; - QString source() const; + QString sourceCode() const; InjectionPoint injectionPoint() const; ScriptWorldId worldId() const; bool runOnSubframes() const; public Q_SLOTS: void setName(QString arg); - void setSource(QString arg); + void setSourceCode(QString arg); void setInjectionPoint(InjectionPoint arg); void setWorldId(ScriptWorldId arg); void setRunOnSubframes(bool arg); Q_SIGNALS: void nameChanged(QString arg); - void sourceChanged(QString arg); + void sourceCodeChanged(QString arg); void injectionPointChanged(InjectionPoint arg); void worldIdChanged(ScriptWorldId arg); void runOnSubframesChanged(bool arg); |