OSDN Git Service

Ver0.26
[gefu/Gefu.git] / thumbnaildelegate.h
1 #ifndef THUMBNAILDELEGATE_H
2 #define THUMBNAILDELEGATE_H
3
4 #include <QStyledItemDelegate>
5
6 class ThumbnailDelegate : public QStyledItemDelegate
7 {
8     Q_OBJECT
9 public:
10     explicit ThumbnailDelegate(QObject *parent = 0);
11
12     void    resetScale();
13     void    scaleDown();
14     void    scaleUp();
15
16 private:
17     double  m_scaleFactor;
18
19 signals:
20
21 public slots:
22
23     // QAbstractItemDelegate interface
24 public:
25     void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
26     QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
27 };
28
29 inline void ThumbnailDelegate::resetScale()
30 {
31     m_scaleFactor = 1.0;
32 }
33
34 inline void ThumbnailDelegate::scaleDown()
35 {
36     m_scaleFactor *= 0.8;
37 }
38
39 inline void ThumbnailDelegate::scaleUp()
40 {
41     m_scaleFactor *= 1.25;
42 }
43
44 #endif // THUMBNAILDELEGATE_H