ok I added some proxy models to all sql models, but they aint done..
This commit is contained in:
parent
cc501873c1
commit
c9f6fc4d1b
8 changed files with 117 additions and 71 deletions
|
@ -208,9 +208,22 @@ QVariantMap ImageSqlModel::getImage(const int &row) {
|
|||
ImageProxyModel::ImageProxyModel(QObject *parent)
|
||||
:QSortFilterProxyModel(parent)
|
||||
{
|
||||
ImageSqlModel *imageModel = new ImageSqlModel;
|
||||
setSourceModel(imageModel);
|
||||
m_imageModel = new ImageSqlModel;
|
||||
setSourceModel(m_imageModel);
|
||||
setDynamicSortFilter(true);
|
||||
setFilterRole(Qt::UserRole + 1);
|
||||
setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
ImageSqlModel *ImageProxyModel::imageModel() {
|
||||
return m_imageModel;
|
||||
}
|
||||
|
||||
QVariantMap ImageProxyModel::getImage(const int &row) {
|
||||
return QVariantMap();
|
||||
}
|
||||
|
||||
void ImageProxyModel::deleteImage(const int &row) {
|
||||
auto model = qobject_cast<ImageSqlModel *>(sourceModel());
|
||||
model->deleteImage(row);
|
||||
}
|
||||
|
|
|
@ -50,11 +50,20 @@ private:
|
|||
class ImageProxyModel : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(ImageSqlModel *imageModel READ imageModel)
|
||||
|
||||
public:
|
||||
explicit ImageProxyModel(QObject *parent = nullptr);
|
||||
~ImageProxyModel() = default;
|
||||
|
||||
ImageSqlModel *imageModel();
|
||||
|
||||
|
||||
public slots:
|
||||
Q_INVOKABLE QVariantMap getImage(const int &row);
|
||||
Q_INVOKABLE void deleteImage(const int &row);
|
||||
|
||||
private:
|
||||
ImageSqlModel *m_imageModel;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -243,9 +243,22 @@ QVariantMap PresentationSqlModel::getPresentation(const int &row) {
|
|||
PresentationProxyModel::PresentationProxyModel(QObject *parent)
|
||||
:QSortFilterProxyModel(parent)
|
||||
{
|
||||
PresentationSqlModel *presentationModel = new PresentationSqlModel;
|
||||
setSourceModel(presentationModel);
|
||||
m_presentationModel = new PresentationSqlModel;
|
||||
setSourceModel(m_presentationModel);
|
||||
setDynamicSortFilter(true);
|
||||
setFilterRole(Qt::UserRole + 1);
|
||||
setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
PresentationSqlModel *PresentationProxyModel::presentationModel() {
|
||||
return m_presentationModel;
|
||||
}
|
||||
|
||||
QVariantMap PresentationProxyModel::getPresentation(const int &row) {
|
||||
return QVariantMap();
|
||||
}
|
||||
|
||||
void PresentationProxyModel::deletePresentation(const int &row) {
|
||||
auto model = qobject_cast<PresentationSqlModel *>(sourceModel());
|
||||
model->deletePresentation(row);
|
||||
}
|
||||
|
|
|
@ -53,14 +53,24 @@ private:
|
|||
int m_pageCount;
|
||||
};
|
||||
|
||||
|
||||
class PresentationProxyModel : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(PresentationSqlModel *presentationModel READ presentationModel)
|
||||
|
||||
public:
|
||||
explicit PresentationProxyModel(QObject *parent = nullptr);
|
||||
~PresentationProxyModel() = default;
|
||||
|
||||
PresentationSqlModel *presentationModel();
|
||||
|
||||
|
||||
public slots:
|
||||
Q_INVOKABLE QVariantMap getPresentation(const int &row);
|
||||
Q_INVOKABLE void deletePresentation(const int &row);
|
||||
|
||||
private:
|
||||
PresentationSqlModel *m_presentationModel;
|
||||
};
|
||||
|
||||
#endif //PRESENTATIONSQLMODEL_H
|
||||
|
|
|
@ -714,9 +714,22 @@ void SongSqlModel::updateFontSize(const int &row, const int &fontSize) {
|
|||
SongProxyModel::SongProxyModel(QObject *parent)
|
||||
:QSortFilterProxyModel(parent)
|
||||
{
|
||||
SongSqlModel *songModel = new SongSqlModel;
|
||||
setSourceModel(songModel);
|
||||
m_songModel = new SongSqlModel;
|
||||
setSourceModel(m_songModel);
|
||||
setDynamicSortFilter(true);
|
||||
setFilterRole(Qt::UserRole + 1);
|
||||
setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
SongSqlModel *SongProxyModel::songModel() {
|
||||
return m_songModel;
|
||||
}
|
||||
|
||||
QVariantMap SongProxyModel::getSong(const int &row) {
|
||||
return QVariantMap();
|
||||
}
|
||||
|
||||
void SongProxyModel::deleteSong(const int &row) {
|
||||
auto model = qobject_cast<SongSqlModel *>(sourceModel());
|
||||
model->deleteSong(row);
|
||||
}
|
||||
|
|
|
@ -111,11 +111,20 @@ private:
|
|||
class SongProxyModel : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(SongSqlModel *songModel READ songModel)
|
||||
|
||||
public:
|
||||
explicit SongProxyModel(QObject *parent = nullptr);
|
||||
~SongProxyModel() = default;
|
||||
|
||||
SongSqlModel *songModel();
|
||||
|
||||
|
||||
public slots:
|
||||
Q_INVOKABLE QVariantMap getSong(const int &row);
|
||||
Q_INVOKABLE void deleteSong(const int &row);
|
||||
|
||||
private:
|
||||
SongSqlModel *m_songModel;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue