maintenance: adding all models as types for direct access

If each model is registered as a QML type, we can pass the model back
to QML from each proxy model to have more direct access to it. This
enables us to use it's functions and properties better.
This commit is contained in:
Chris Cochrun 2023-05-17 10:11:33 -05:00
parent 3a3c4f9c5c
commit 8efabbdf68
3 changed files with 15 additions and 4 deletions

View file

@ -757,6 +757,10 @@ QVariantMap SongProxyModel::getSong(const int &row) {
return song;
}
void SongProxyModel::newSong() {
m_songModel->newSong();
}
void SongProxyModel::deleteSong(const int &row) {
auto model = qobject_cast<SongModel *>(sourceModel());
model->removeItem(row);

View file

@ -131,6 +131,7 @@ public:
public slots:
Q_INVOKABLE QVariantMap getSong(const int &row);
Q_INVOKABLE void newSong();
Q_INVOKABLE void deleteSong(const int &row);
Q_INVOKABLE void deleteSongs(const QVector<int> &rows);
Q_INVOKABLE QStringList getLyricList(const int &row);