34 lines
1.1 KiB
C++
34 lines
1.1 KiB
C++
|
|
// /mnt/c/Users/javie/wino-mail-dtkqt/include/folderlistmodel.h
|
||
|
|
#ifndef FOLDERLISTMODEL_H
|
||
|
|
#define FOLDERLISTMODEL_H
|
||
|
|
|
||
|
|
#include <QAbstractItemModel>
|
||
|
|
#include <QStringList>
|
||
|
|
#include <QModelIndex>
|
||
|
|
#include <QSortFilterProxyModel>
|
||
|
|
|
||
|
|
class FolderListModel : public QAbstractItemModel
|
||
|
|
{
|
||
|
|
Q_OBJECT
|
||
|
|
|
||
|
|
public:
|
||
|
|
explicit FolderListModel(QObject *parent = nullptr);
|
||
|
|
|
||
|
|
// QAbstractItemModel interface
|
||
|
|
QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const override;
|
||
|
|
QModelIndex parent(int row, const QModelIndex &parent = QModelIndex()) const override;
|
||
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||
|
|
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||
|
|
|
||
|
|
// Public interface for setting data
|
||
|
|
void setFolders(const QStringList& folders);
|
||
|
|
|
||
|
|
// Helper to get data (for demonstration)
|
||
|
|
QStringList getFolders() const { return m_folders; }
|
||
|
|
|
||
|
|
private:
|
||
|
|
QStringList m_folders;
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif // FOLDERLISTMODEL_H
|