1 #ifndef FILETABLEMODEL_H
\r
2 #define FILETABLEMODEL_H
\r
4 #include <QAbstractTableModel>
\r
6 #include <QFileIconProvider>
\r
7 #include <QFileSystemWatcher>
\r
11 class FileTableModel : public QAbstractTableModel
\r
15 explicit FileTableModel(QObject *parent = 0);
\r
17 bool setPath(const QString &path);
\r
19 QDir::Filters filter() const { return m_dir.filter(); }
\r
20 void setFilter(QDir::Filters filters) { m_dir.setFilter(filters); }
\r
22 QDir::SortFlags sorting() const { return m_dir.sorting(); }
\r
23 void setSorting(QDir::SortFlags sort) { m_dir.setSorting(sort); }
\r
25 Qt::CheckState checkState(const QModelIndex &index) const;
\r
26 void setCheckState(const QModelIndex &index, Qt::CheckState state);
\r
27 void setCheckStateAll(Qt::CheckState state);
\r
29 bool isDir(const QModelIndex &index) const;
\r
30 const QString absolutePath() const { return m_dir.absolutePath(); }
\r
31 const QString absoluteFilePath(const QModelIndex &index) const;
\r
32 QFileInfoList checkedItems() const;
\r
33 QFileInfo fileInfo(const QModelIndex &index) const;
\r
35 void updateAppearance();
\r
38 void rootChanged(const QString &root);
\r
39 void stateChanged(int checkedFoldrs, int checkedFiles, quint64 totalSize);
\r
41 void filesDropped(const QFileInfoList &list);
\r
48 QFileInfoList m_fileInfoList;
\r
49 QVector<Qt::CheckState> m_checkStates;
\r
50 QFileIconProvider m_IconFactory;
\r
51 QFileSystemWatcher *m_fsWatcher;
\r
53 QBrush m_NormalBrush;
\r
54 QBrush m_NormalTextBrush;
\r
56 QBrush m_MarkTextBrush;
\r
57 QBrush m_SystemBrush;
\r
58 QBrush m_HiddenBrush;
\r
59 QBrush m_ReadonlyBrush;
\r
61 void stateChanged();
\r
63 // QAbstractItemModel interface
\r
65 int rowCount(const QModelIndex &parent = QModelIndex()) const;
\r
66 int columnCount(const QModelIndex &parent = QModelIndex()) const;
\r
67 QVariant data(const QModelIndex &index, int role) const;
\r
68 QVariant headerData(int section, Qt::Orientation orientation, int role) const;
\r
69 Qt::ItemFlags flags(const QModelIndex &index) const;
\r
70 bool setData(const QModelIndex &index, const QVariant &value, int role);
\r
71 Qt::DropActions supportedDropActions() const;
\r
72 QStringList mimeTypes() const;
\r
73 bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
\r
78 #endif // FILETABLEMODEL_H
\r