From a80cad73eb214d69d2a21c6e59e4e20b72b362eb Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 24 Feb 2023 15:02:05 -0600 Subject: [PATCH] adding a getLyricList function to songProxyModel --- src/cpp/songsqlmodel.cpp | 6 ++++++ src/cpp/songsqlmodel.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/cpp/songsqlmodel.cpp b/src/cpp/songsqlmodel.cpp index c67e087..c729b89 100644 --- a/src/cpp/songsqlmodel.cpp +++ b/src/cpp/songsqlmodel.cpp @@ -760,6 +760,12 @@ QModelIndex SongProxyModel::idx(int row) { return idx; } +QStringList SongProxyModel::getLyricList(const int &row) { + auto model = qobject_cast(sourceModel()); + QStringList lyrics = model->getLyricList(mapToSource(index(row, 0)).row()); + return lyrics; +} + QVariantMap SongProxyModel::getSong(const int &row) { auto model = qobject_cast(sourceModel()); QVariantMap song = model->getSong(mapToSource(index(row, 0)).row()); diff --git a/src/cpp/songsqlmodel.h b/src/cpp/songsqlmodel.h index d355510..d33b5da 100644 --- a/src/cpp/songsqlmodel.h +++ b/src/cpp/songsqlmodel.h @@ -129,6 +129,7 @@ public: public slots: Q_INVOKABLE QVariantMap getSong(const int &row); Q_INVOKABLE void deleteSong(const int &row); + Q_INVOKABLE QStringList getLyricList(const int &row); // Q_INVOKABLE void select(int row); // Q_INVOKABLE void selectSongs(int row); // Q_INVOKABLE bool setSelected(const int &row, const bool &select);