StandardManageView.h 940 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef STANDARDMANAGEVIEW_H
  2. #define STANDARDMANAGEVIEW_H
  3. #include <QFileSystemModel>
  4. #include <QStyledItemDelegate>
  5. #include <QTreeView>
  6. #include <QWidget>
  7. class CDelegate : public QStyledItemDelegate
  8. {
  9. Q_OBJECT
  10. public:
  11. CDelegate(QObject *parent) : QStyledItemDelegate(parent) { }
  12. protected:
  13. QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
  14. {
  15. QSize size = QStyledItemDelegate::sizeHint(option, index);
  16. return QSize(size.width(), 35);
  17. }
  18. };
  19. class StandardManageView : public QWidget
  20. {
  21. Q_OBJECT
  22. public:
  23. explicit StandardManageView(QWidget *parent = nullptr);
  24. signals:
  25. private:
  26. QFileSystemModel *m_fileModel;
  27. QTreeView *m_treeView;
  28. QString m_dir;
  29. // QWidget interface
  30. protected:
  31. virtual void resizeEvent(QResizeEvent *event) override;
  32. private slots:
  33. void onDoubleClick(const QModelIndex &index);
  34. };
  35. #endif // STANDARDMANAGEVIEW_H