Debian Codegraph @

src/album/thumbnail/imgviewdelegate.h

raw
1 /*
2 * Copyright (C) 2020 ~ 2021 Uniontech Software Technology Co., Ltd.
3 *
4 * Author: ZhangYong <[email protected]>
5 *
6 * Maintainer: ZhangYong <[email protected]>
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21 #ifndef IMGVIEWDELEGATE_H
22 #define IMGVIEWDELEGATE_H
23
24 #include <QObject>
25 #include <QDateTime>
26 #include <QStyledItemDelegate>
27 #include <QDebug>
28
29 #include "albumgloabl.h"
30
31 class TDThumbnailThread;
32 class ImgViewDelegate : public QStyledItemDelegate
33 {
34 Q_OBJECT
35
36 public:
37 enum DelegateType {
38 NullType = 0,
39 AllPicViewType,
40 AlbumViewType,
41 AlbumViewPhoneType,
42 TimeLineViewType,
43 SearchViewType
44 };
45
46 explicit ImgViewDelegate(QObject *parent = nullptr);
47
48 void setItemSize(QSize size);
49 void paint(QPainter *painter,
50 const QStyleOptionViewItem &option,
51 const QModelIndex &index) const Q_DECL_OVERRIDE;
52 QSize sizeHint(const QStyleOptionViewItem &option,
53 const QModelIndex &index) const Q_DECL_OVERRIDE;
54 bool editorEvent(QEvent *event,
55 QAbstractItemModel *model,
56 const QStyleOptionViewItem &option,
57 const QModelIndex &index) Q_DECL_OVERRIDE;
58 private slots:
59 void onThemeTypeChanged(int themeType);
60 signals:
61
62 private:
63 DBImgInfo itemData(const QModelIndex &index) const;
64
65 public:
66
67 private:
68 QPixmap m_default;
69 QPixmap m_videoDefault;//视频默认图片
70 QPixmap m_damagePixmap;
71 };
72
73 #endif // ALBUMDELEGATE_H