listviewdelegate.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef LISTVIEWDELEGATE_H
  2. #define LISTVIEWDELEGATE_H
  3. #include <QStyledItemDelegate>
  4. #include <QtGui>
  5. #include <QMap>
  6. #include <QFileSystemModel>
  7. class ListViewDelegate : public QStyledItemDelegate
  8. {
  9. public:
  10. explicit ListViewDelegate();
  11. virtual ~ListViewDelegate();
  12. enum datarole {headerTextRole = Qt::UserRole + 100,subHeaderTextrole = Qt::UserRole+101,IconRole = Qt::UserRole+102};
  13. void paint(QPainter *painter, const QStyleOptionViewItem &option,
  14. const QModelIndex &index) const;
  15. QSize sizeHint(const QStyleOptionViewItem &option,
  16. const QModelIndex &index ) const;
  17. enum Status {
  18. FileClear,
  19. FileModified,
  20. FileUnknown,
  21. FileAdded
  22. };
  23. void setOverlayStatus(qint64 index,int status);
  24. void removeOverlayStatus(qint64 index);
  25. int testOverlayStatus(qint64 index);
  26. void setBasePath(QString path);
  27. void setMap(QMap <qint64, int>*map);
  28. public slots:
  29. private:
  30. QMap <qint64, int>*map;
  31. QString basePath;
  32. QFileSystemModel *fileModel;
  33. };
  34. #endif // LISTVIEWDELEGATE_H