songsqlmodel working
This commit is contained in:
parent
d647f4442f
commit
641b884901
13 changed files with 342 additions and 33 deletions
50
src/songsqlmodel.h
Normal file
50
src/songsqlmodel.h
Normal file
|
@ -0,0 +1,50 @@
|
|||
#ifndef SONGSQLMODEL_H
|
||||
#define SONGSQLMODEL_H
|
||||
|
||||
#include <QSqlTableModel>
|
||||
#include <qqml.h>
|
||||
|
||||
class SongSqlModel : public QSqlTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
|
||||
Q_PROPERTY(QString lyrics READ lyrics WRITE setLyrics NOTIFY lyricsChanged)
|
||||
Q_PROPERTY(QString author READ author WRITE setAuthor NOTIFY authorChanged)
|
||||
Q_PROPERTY(QString ccli READ ccli WRITE setCcli NOTIFY ccliChanged)
|
||||
Q_PROPERTY(QString audio READ audio WRITE setAudio NOTIFY audioChanged)
|
||||
QML_ELEMENT
|
||||
|
||||
public:
|
||||
SongSqlModel(QObject *parent = 0);
|
||||
|
||||
QString title() const;
|
||||
QString lyrics() const;
|
||||
QString author() const;
|
||||
QString ccli() const;
|
||||
QString audio() const;
|
||||
|
||||
void setTitle(const QString &title);
|
||||
void setLyrics(const QString &lyrics);
|
||||
void setAuthor(const QString &author);
|
||||
void setCcli(const QString &ccli);
|
||||
void setAudio(const QString &audio);
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
signals:
|
||||
void titleChanged();
|
||||
void lyricsChanged();
|
||||
void authorChanged();
|
||||
void ccliChanged();
|
||||
void audioChanged();
|
||||
|
||||
private:
|
||||
QString m_title;
|
||||
QString m_lyrics;
|
||||
QString m_author;
|
||||
QString m_ccli;
|
||||
QString m_audio;
|
||||
};
|
||||
|
||||
#endif //SONGSQLMODEL_H
|
Loading…
Add table
Add a link
Reference in a new issue