D9141: Setup QQmlEngine only once in QmlObject
Kai Uwe Broulik
noreply at phabricator.kde.org
Sun Dec 3 15:49:24 UTC 2017
broulik created this revision.
broulik added a reviewer: Plasma.
Restricted Application added projects: Plasma, Frameworks.
Restricted Application added subscribers: Frameworks, plasma-devel.
REVISION SUMMARY
`setupBindings` is called for every `QmlObject` created and installs various bits on the `QQmlEngine`, such as a network access manager, a theme icon provider, etc. However, since we use a shared `QQmlEngine` in various places, most of this needs to be done only once.
This splits `setupBindings` into a `setupContext` method for setting up the localized context needed for every instance and a `setupEngine` static function that setups an engine. A fourth constructor is added that allows to influence the setup behavior. While at it, delegating constructors are used doing both to not change behavior.
TEST PLAN
I now have the same thing done only twice instead of like 26 times. Once when the shared engine is created and another time (`setupbindings` in corebindingsplugin in plasma which probably can go?)
REPOSITORY
R296 KDeclarative
REVISION DETAIL
https://phabricator.kde.org/D9141
AFFECTED FILES
src/kdeclarative/kdeclarative.cpp
src/kdeclarative/kdeclarative.h
src/kdeclarative/qmlobject.cpp
src/kdeclarative/qmlobject.h
src/kdeclarative/qmlobjectsharedengine.cpp
To: broulik, #plasma
Cc: plasma-devel, #frameworks, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20171203/2eac271d/attachment.html>
More information about the Kde-frameworks-devel
mailing list