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

Reply via email to