digiKam
versionsdelegate.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2010-07-15
7  * Description : Item delegate for image versions list view
8  *
9  * Copyright (C) 2010-2011 by Martin Klapetek <martin dot klapetek at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_VERSIONS_DELEGATE_H
25 #define DIGIKAM_VERSIONS_DELEGATE_H
26 
27 // Qt includes
28 
29 #include <QStyledItemDelegate>
30 
31 // Local includes
32 
33 #include "digikam_export.h"
34 #include "itemdelegateoverlay.h"
35 
36 namespace Digikam
37 {
38 
39 class VersionsDelegate : public QStyledItemDelegate,
41 {
42  Q_OBJECT
43  Q_PROPERTY(int animationState READ animationState
44  WRITE setAnimationState
45  NOTIFY animationStateChanged)
46 
47 public:
48 
49  explicit VersionsDelegate(QObject* const parent);
50  ~VersionsDelegate() override;
51 
52  QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override;
53  void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
54 
55  void beginPainting();
56  void finishPainting();
57 
58  int animationState() const;
60 
61  void setThumbnailSize(int size) const;
62  int thumbnailSize() const;
63 
64 Q_SIGNALS:
65 
67  void visualChange(); // for ItemDelegateOverlayContainer
68 
70  void requestNotification(const QModelIndex& index, const QString& message);
72 
73 protected Q_SLOTS:
74 
75  void overlayDestroyed(QObject* o) override
76  {
78  }
79 
80 protected:
81 
82  void initStyleOption(QStyleOptionViewItem* option, const QModelIndex& index) const override;
83 
85  QAbstractItemDelegate* asDelegate() override
86  {
87  return this;
88  }
89 
90 private:
91 
92  VersionsDelegate(); // Disable default constructor.
93 
94 private:
95 
96  class Private;
97  Private* const d;
98 };
99 
100 } // namespace Digikam
101 
102 #endif // DIGIKAM_VERSIONS_DELEGATE_H
Definition: itemdelegateoverlay.h:333
virtual void overlayDestroyed(QObject *o)
Declare as slot in the derived class calling this method.
Definition: itemdelegateoverlay.cpp:753
Definition: versionsdelegate.h:41
void requestNotification(const QModelIndex &index, const QString &message)
NOTE: for ItemDelegateOverlayContainer, unimplemented:
void overlayDestroyed(QObject *o) override
Definition: versionsdelegate.h:75
void setAnimationState(int animationState)
Definition: versionsdelegate.cpp:125
QAbstractItemDelegate * asDelegate() override
Returns the delegate, typically, the derived class.
Definition: versionsdelegate.h:85
void setThumbnailSize(int size) const
Definition: versionsdelegate.cpp:136
void beginPainting()
Definition: versionsdelegate.cpp:146
int thumbnailSize() const
Definition: versionsdelegate.cpp:141
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
Definition: versionsdelegate.cpp:166
~VersionsDelegate() override
Definition: versionsdelegate.cpp:114
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Definition: versionsdelegate.cpp:204
void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const override
Definition: versionsdelegate.cpp:237
int animationState
Definition: versionsdelegate.h:45
void finishPainting()
Definition: versionsdelegate.cpp:151
Definition: datefolderview.cpp:43