123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #ifndef LISTVIEWDELEGATE_H
- #define LISTVIEWDELEGATE_H
- #include <QStyledItemDelegate>
- #include <QtGui>
- #include <QMap>
- #include <QFileSystemModel>
- class ListViewDelegate : public QStyledItemDelegate
- {
- public:
- explicit ListViewDelegate();
- virtual ~ListViewDelegate();
- enum datarole {headerTextRole = Qt::UserRole + 100,subHeaderTextrole = Qt::UserRole+101,IconRole = Qt::UserRole+102};
- void paint(QPainter *painter, const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
- QSize sizeHint(const QStyleOptionViewItem &option,
- const QModelIndex &index ) const;
- enum Status {
- FileClear,
- FileModified,
- FileUnknown,
- FileAdded
- };
- void setOverlayStatus(qint64 index,int status);
- void removeOverlayStatus(qint64 index);
- int testOverlayStatus(qint64 index);
- void setBasePath(QString path);
- void setMap(QMap <qint64, int>*map);
- public slots:
- private:
- QMap <qint64, int>*map;
- QString basePath;
- QFileSystemModel *fileModel;
- };
- #endif // LISTVIEWDELEGATE_H
|