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:
parent
3a3c4f9c5c
commit
8efabbdf68
3 changed files with 15 additions and 4 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue