File indexing completed on 2025-01-19 03:56:16
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2010-12-26 0007 * Description : images versions QTreeView 0008 * 0009 * SPDX-FileCopyrightText: 2010 by Martin Klapetek <martin dot klapetek at gmail dot com> 0010 * SPDX-FileCopyrightText: 2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #ifndef DIGIKAM_VERSIONS_TREEVIEW_H 0017 #define DIGIKAM_VERSIONS_TREEVIEW_H 0018 0019 // Qt includes 0020 0021 #include <QTreeView> 0022 0023 // Local includes 0024 0025 #include "digikam_export.h" 0026 #include "dragdropimplementations.h" 0027 0028 namespace Digikam 0029 { 0030 0031 class VersionsDelegate; 0032 class ItemDelegateOverlay; 0033 0034 class VersionsTreeView : public QTreeView, 0035 public DragDropViewImplementation 0036 { 0037 Q_OBJECT 0038 0039 public: 0040 0041 explicit VersionsTreeView(QWidget* const parent = nullptr); 0042 ~VersionsTreeView() override; 0043 0044 void setToolTipEnabled(bool on); 0045 0046 void addOverlay(ItemDelegateOverlay* overlay); 0047 void removeOverlay(ItemDelegateOverlay* overlay); 0048 0049 VersionsDelegate* delegate() const; 0050 0051 protected: 0052 0053 void paintEvent(QPaintEvent* e) override; 0054 void mouseMoveEvent(QMouseEvent* event) override; 0055 bool viewportEvent(QEvent* event) override; 0056 QModelIndex moveCursor(CursorAction cursorAction, 0057 Qt::KeyboardModifiers modifiers) override; 0058 0059 DECLARE_VIEW_DRAG_DROP_METHODS(QTreeView) 0060 QModelIndex mapIndexForDragDrop(const QModelIndex& index) const override; 0061 QPixmap pixmapForDrag(const QList<QModelIndex>& indexes) const override; 0062 AbstractItemDragDropHandler* dragDropHandler() const override; 0063 virtual void setDragDropHandler(AbstractItemDragDropHandler* handler); 0064 0065 protected: 0066 0067 class ToolTip; 0068 0069 VersionsDelegate* m_delegate; 0070 AbstractItemDragDropHandler* m_dragDropHandler; 0071 bool m_showToolTip; 0072 ToolTip* m_toolTip; 0073 0074 private: 0075 0076 // Disable 0077 VersionsTreeView(const VersionsTreeView&) = delete; 0078 VersionsTreeView& operator=(const VersionsTreeView&) = delete; 0079 }; 0080 0081 } // namespace Digikam 0082 0083 #endif // DIGIKAM_VERSIONS_TREEVIEW_H