adding a way to get modelIndex from songProxyModel
This commit is contained in:
parent
aba253559c
commit
5cc531f046
2 changed files with 14 additions and 0 deletions
|
@ -710,6 +710,13 @@ void SongSqlModel::updateFontSize(const int &row, const int &fontSize) {
|
||||||
submitAll();
|
submitAll();
|
||||||
emit fontSizeChanged();
|
emit fontSizeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QModelIndex SongSqlModel::idx(int row) {
|
||||||
|
QModelIndex idx = index(row, 0);
|
||||||
|
// qDebug() << idx;
|
||||||
|
return idx;
|
||||||
|
}
|
||||||
|
|
||||||
// SongProxyModel
|
// SongProxyModel
|
||||||
|
|
||||||
SongProxyModel::SongProxyModel(QObject *parent)
|
SongProxyModel::SongProxyModel(QObject *parent)
|
||||||
|
@ -734,6 +741,11 @@ QModelIndex SongProxyModel::idx(int row) {
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QModelIndex SongProxyModel::modelIndex(int row) {
|
||||||
|
QModelIndex idx = m_songModel->idx(mapToSource(index(row, 0)).row());
|
||||||
|
return idx;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList SongProxyModel::getLyricList(const int &row) {
|
QStringList SongProxyModel::getLyricList(const int &row) {
|
||||||
QStringList lyrics = m_songModel->getLyricList(mapToSource(index(row, 0)).row());
|
QStringList lyrics = m_songModel->getLyricList(mapToSource(index(row, 0)).row());
|
||||||
return lyrics;
|
return lyrics;
|
||||||
|
|
|
@ -70,6 +70,7 @@ public:
|
||||||
const QString &horizontalTextAlignment);
|
const QString &horizontalTextAlignment);
|
||||||
Q_INVOKABLE void updateFont(const int &row, const QString &font);
|
Q_INVOKABLE void updateFont(const int &row, const QString &font);
|
||||||
Q_INVOKABLE void updateFontSize(const int &row, const int &fontSize);
|
Q_INVOKABLE void updateFontSize(const int &row, const int &fontSize);
|
||||||
|
Q_INVOKABLE QModelIndex idx(int row);
|
||||||
|
|
||||||
Q_INVOKABLE void newSong();
|
Q_INVOKABLE void newSong();
|
||||||
Q_INVOKABLE void deleteSong(const int &row);
|
Q_INVOKABLE void deleteSong(const int &row);
|
||||||
|
@ -121,6 +122,7 @@ public:
|
||||||
|
|
||||||
SongSqlModel *songModel();
|
SongSqlModel *songModel();
|
||||||
Q_INVOKABLE QModelIndex idx(int row);
|
Q_INVOKABLE QModelIndex idx(int row);
|
||||||
|
Q_INVOKABLE QModelIndex modelIndex(int row);
|
||||||
// Q_INVOKABLE bool selected(const int &row);
|
// Q_INVOKABLE bool selected(const int &row);
|
||||||
|
|
||||||
// QVariant data(const QModelIndex &index, int role) const override;
|
// QVariant data(const QModelIndex &index, int role) const override;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue