代码拉取完成,页面将自动刷新
#ifndef LOCALMUSICMODEL_H
#define LOCALMUSICMODEL_H
#include <QObject>
#include <QSqlTableModel>
#include <QMediaPlayer>
#include "libzplay.h"
using namespace libZPlay;
struct songInfo
{
QString Artist;
QString title;
QString album;
qint32 duration = 0;
QString path;
};
class LocalMusicModel : public QSqlTableModel
{
Q_OBJECT
Q_PROPERTY(int m_musicNum READ musicNum WRITE setMusicNum NOTIFY musicNumChanged)
public:
explicit LocalMusicModel(QObject *parent = nullptr);
QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
Q_INVOKABLE void reloadMusicRecord(const QString &path);
int musicNum(){return m_musicNum;}
void setMusicNum(int val){
m_musicNum = val;
emit musicNumChanged();
}
signals:
void musicNumChanged();
private:
void parseMusicInfo(QString path);
void clearDb();
private:
ZPlay *player;
int m_musicNum = 0;
};
#endif // LOCALMUSICMODEL_H
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。