Skip to content

Commit

Permalink
Merge pull request #4591 from Holzhaus/qml-library-model-type-fix
Browse files Browse the repository at this point in the history
QML: Don't use parented_ptr for model in QmlLibraryProxy
  • Loading branch information
uklotzde authored Jan 3, 2022
2 parents 6680a31 + e68a4d6 commit c65c54a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/qml/qmllibraryproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace qml {
QmlLibraryProxy::QmlLibraryProxy(std::shared_ptr<Library> pLibrary, QObject* parent)
: QObject(parent),
m_pLibrary(pLibrary),
m_pModel(make_parented<QmlLibraryTrackListModel>(m_pLibrary->trackTableModel(), this)) {
m_pModelProperty(new QmlLibraryTrackListModel(m_pLibrary->trackTableModel(), this)) {
}

} // namespace qml
Expand Down
6 changes: 4 additions & 2 deletions src/qml/qmllibraryproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<Library> pLibrary, QObject* parent = nullptr);

private:
std::shared_ptr<Library> m_pLibrary;
parented_ptr<QmlLibraryTrackListModel> m_pModel;

/// This needs to be a plain pointer because it's used as a `Q_PROPERTY` member variable.
QmlLibraryTrackListModel* m_pModelProperty;
};

} // namespace qml
Expand Down

0 comments on commit c65c54a

Please sign in to comment.