D26543: Unbreak the KNSQuick::Engine::changedEntries functionality
Dan Leinir Turthra Jensen
noreply at phabricator.kde.org
Thu Jan 9 13:41:15 GMT 2020
leinir created this revision.
Herald added a project: Frameworks.
Herald added a subscriber: kde-frameworks-devel.
leinir requested review of this revision.
REVISION SUMMARY
This patch changes the previous naive approach to a more elaborate,
QQmlListProperty based one. It further introduces a QObject based
wrapper EntryInternal, in preparation for refactoring for KF6.
The rationale for this approach (rather than e.g. using a model)
is that the approach makes for the simplest possible porting from
the QWidget based methods.
Add a QObject wrapper for EntryInternal
We can't reasonably change EntryInternal to a QObject at the moment,
as that would make the assumptions about how it's used throughout
the codebase not quite correct, so until breakage is allowed, add
a class which wraps up an object and which works more like one would
expect a QObject to behave.
Register the wrapper with QtQuick (and clean the plugin a tiny bit)
Switch to a QQmlListProperty
The issue with the previous approach is that KNSCore::EntryInternal
is not a QObject, and so the list can't be used verbatim. This
allows us to do things a little bit roundabout, but also reasonably
simply.
Using an alias turns out to be fragile when digging through layers
Previously, the property would fail to resolve on the first try,
and consequently would just stop attempting the resolution entirely.
This binding, while suboptimal compared to aliasing, at least
forwards the data correctly.
TEST PLAN
Without this patch, changedEntries cannot be read by any user of the code
With it, changedEntries can be passed through to any C++ consumer, and read out using the standard QQmlListReference method
REPOSITORY
R304 KNewStuff
BRANCH
unbreak-changedentries-in-qtquick (branched from master)
REVISION DETAIL
https://phabricator.kde.org/D26543
AFFECTED FILES
src/core/CMakeLists.txt
src/core/entrywrapper.cpp
src/core/entrywrapper.h
src/qtquick/qml/Button.qml
src/qtquick/qmlplugin.cpp
src/qtquick/quickengine.cpp
src/qtquick/quickengine.h
To: leinir
Cc: kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200109/8fdb0d4c/attachment.html>
More information about the Kde-frameworks-devel
mailing list