From e68a4d6b1352c193167a0da5b740a2329937367b Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 30 Dec 2021 00:57:24 +0100 Subject: [PATCH] QML: Don't use parented_ptr for model in QmlLibraryProxy The type needs to match the Q_PROPERTY declaration. --- src/qml/qmllibraryproxy.cpp | 2 +- src/qml/qmllibraryproxy.h | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/qml/qmllibraryproxy.cpp b/src/qml/qmllibraryproxy.cpp index bf54bcedded..6a17b6134f7 100644 --- a/src/qml/qmllibraryproxy.cpp +++ b/src/qml/qmllibraryproxy.cpp @@ -10,7 +10,7 @@ namespace qml { QmlLibraryProxy::QmlLibraryProxy(std::shared_ptr pLibrary, QObject* parent) : QObject(parent), m_pLibrary(pLibrary), - m_pModel(make_parented(m_pLibrary->trackTableModel(), this)) { + m_pModelProperty(new QmlLibraryTrackListModel(m_pLibrary->trackTableModel(), this)) { } } // namespace qml diff --git a/src/qml/qmllibraryproxy.h b/src/qml/qmllibraryproxy.h index d685d34f1fd..fcc18ca994f 100644 --- a/src/qml/qmllibraryproxy.h +++ b/src/qml/qmllibraryproxy.h @@ -14,14 +14,16 @@ class QmlLibraryTrackListModel; class QmlLibraryProxy : public QObject { Q_OBJECT - Q_PROPERTY(mixxx::qml::QmlLibraryTrackListModel* model MEMBER m_pModel CONSTANT) + Q_PROPERTY(mixxx::qml::QmlLibraryTrackListModel* model MEMBER m_pModelProperty CONSTANT) public: explicit QmlLibraryProxy(std::shared_ptr pLibrary, QObject* parent = nullptr); private: std::shared_ptr m_pLibrary; - parented_ptr m_pModel; + + /// This needs to be a plain pointer because it's used as a `Q_PROPERTY` member variable. + QmlLibraryTrackListModel* m_pModelProperty; }; } // namespace qml