digiKam
versionstreeview.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-12-26
7  * Description : images versions QTreeView
8  *
9  * Copyright (C) 2010 by Martin Klapetek <martin dot klapetek at gmail dot com>
10  * Copyright (C) 2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_VERSIONS_TREEVIEW_H
26 #define DIGIKAM_VERSIONS_TREEVIEW_H
27 
28 // Qt includes
29 
30 #include <QTreeView>
31 
32 // Local includes
33 
34 #include "digikam_export.h"
36 
37 namespace Digikam
38 {
39 
40 class VersionsDelegate;
41 class ItemDelegateOverlay;
42 
43 class VersionsTreeView : public QTreeView,
45 {
46  Q_OBJECT
47 
48 public:
49 
50  explicit VersionsTreeView(QWidget* const parent = nullptr);
51  ~VersionsTreeView() override;
52 
53  void setToolTipEnabled(bool on);
54 
55  void addOverlay(ItemDelegateOverlay* overlay);
56  void removeOverlay(ItemDelegateOverlay* overlay);
57 
58  VersionsDelegate* delegate() const;
59 
60 protected:
61 
62  void paintEvent(QPaintEvent* e) override;
63  void mouseMoveEvent(QMouseEvent* event) override;
64  bool viewportEvent(QEvent* event) override;
65  QModelIndex moveCursor(CursorAction cursorAction,
66  Qt::KeyboardModifiers modifiers) override;
67 
69  QModelIndex mapIndexForDragDrop(const QModelIndex& index) const override;
70  QPixmap pixmapForDrag(const QList<QModelIndex>& indexes) const override;
72  virtual void setDragDropHandler(AbstractItemDragDropHandler* handler);
73 
74 protected:
75 
76  class ToolTip;
77 
81  ToolTip* m_toolTip;
82 
83 private:
84 
85  // Disable
86  VersionsTreeView(const VersionsTreeView&) = delete;
87  VersionsTreeView& operator=(const VersionsTreeView&) = delete;
88 };
89 
90 } // namespace Digikam
91 
92 #endif // DIGIKAM_VERSIONS_TREEVIEW_H
Definition: abstractitemdragdrophandler.h:42
Definition: dragdropimplementations.h:113
Definition: itemdelegateoverlay.h:41
Definition: versionsdelegate.h:41
Definition: versionstreeview.h:45
void setToolTipEnabled(bool on)
Definition: versionstreeview.cpp:147
VersionsDelegate * m_delegate
Definition: versionstreeview.h:76
void paintEvent(QPaintEvent *e) override
Definition: versionstreeview.cpp:162
ToolTip * m_toolTip
Definition: versionstreeview.h:81
AbstractItemDragDropHandler * m_dragDropHandler
Definition: versionstreeview.h:79
void addOverlay(ItemDelegateOverlay *overlay)
Definition: versionstreeview.cpp:134
~VersionsTreeView() override
NOTE: All overlay management code in a sophisticated form can be studied in ItemCategorizedView.
Definition: versionstreeview.cpp:124
bool m_showToolTip
Definition: versionstreeview.h:80
VersionsDelegate * delegate() const
Definition: versionstreeview.cpp:129
VersionsTreeView(QWidget *const parent=nullptr)
Definition: versionstreeview.cpp:110
void mouseMoveEvent(QMouseEvent *event) override
Definition: versionstreeview.cpp:176
QPixmap pixmapForDrag(const QList< QModelIndex > &indexes) const override
Definition: versionstreeview.cpp:206
void removeOverlay(ItemDelegateOverlay *overlay)
Definition: versionstreeview.cpp:141
QModelIndex mapIndexForDragDrop(const QModelIndex &index) const override
Definition: versionstreeview.cpp:201
bool viewportEvent(QEvent *event) override
Definition: versionstreeview.cpp:225
QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override
Definition: versionstreeview.cpp:169
AbstractItemDragDropHandler * dragDropHandler() const override
Definition: versionstreeview.cpp:196
virtual void setDragDropHandler(AbstractItemDragDropHandler *handler)
Definition: versionstreeview.cpp:191
#define DECLARE_VIEW_DRAG_DROP_METHODS(ParentViewClass)
Definition: dragdropimplementations.h:155
Definition: datefolderview.cpp:43