Unbreak the KNSQuick::Engine::changedEntries functionality

Authored by leinir on Jan 16 2020, 9:14 AM.

Description

Unbreak the KNSQuick::Engine::changedEntries functionality

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

Reviewers: Frameworks, Plasma, ngraham, broulik, mart, davidedmundson

Reviewed By: Plasma, davidedmundson

Subscribers: davidedmundson, kde-frameworks-devel

Tags: Frameworks

Differential Revision: https://phabricator.kde.org/D26543

Details