digiKam
tableview_treeview.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 : 2013-03-02
7  * Description : Table view: Tree view subelement
8  *
9  * Copyright (C) 2017-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2013 by Michael G. Hansen <mike at mghansen 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) 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_TABLE_VIEW_TREEVIEW_H
25 #define DIGIKAM_TABLE_VIEW_TREEVIEW_H
26 
27 // Qt includes
28 
29 #include <QTreeView>
30 #include <QWidget>
31 
32 // Local includes
33 
34 #include "digikam_export.h"
36 #include "itemalbummodel.h"
37 #include "itemfiltermodel.h"
38 #include "statesavingobject.h"
40 #include "tableview_shared.h"
41 #include "thumbnailloadthread.h"
43 
44 class QMenu;
45 class QContextMenuEvent;
46 
47 namespace Digikam
48 {
49 
56 class TableViewTreeView : public QTreeView,
59 {
60  Q_OBJECT
61 
62 public:
63 
64  explicit TableViewTreeView(TableViewShared* const tableViewShared, QWidget* const parent = nullptr);
65  ~TableViewTreeView() override;
66 
67  Album* albumAt(const QPoint& pos) const;
68 
69 protected:
70 
71  bool eventFilter(QObject* watched, QEvent* event) override;
72 
74 
76  QModelIndex mapIndexForDragDrop(const QModelIndex& index) const override;
77  QPixmap pixmapForDrag(const QList<QModelIndex>& indexes) const override;
78  void wheelEvent(QWheelEvent* event) override;
79 
80  bool hasHiddenGroupedImages(const ItemInfo& info) const override;
81 
82 private:
83 
84  void addColumnDescriptionsToMenu(const QList<TableViewColumnDescription>& columnDescriptions, QMenu* const menu);
85  void showHeaderContextMenu(QEvent* const event);
86 
87 private Q_SLOTS:
88 
89  void slotHeaderContextMenuAddColumn();
90  void slotHeaderContextMenuConfigureColumn();
91  void slotHeaderContextMenuActionRemoveColumnTriggered();
92  void slotModelGroupingModeChanged();
93 
94 Q_SIGNALS:
95 
98 
99 private:
100 
101  class Private;
102 
103  const QScopedPointer<Private> d;
104  TableViewShared* const s;
105 };
106 
107 } // namespace Digikam
108 
109 #endif // DIGIKAM_TABLE_VIEW_TREEVIEW_H
Definition: abstractitemdragdrophandler.h:42
Abstract base class for all album types.
Definition: album.h:67
Definition: dragdropimplementations.h:113
Definition: groupingviewimplementation.h:39
Definition: iteminfo.h:78
Definition: tableview_shared.h:44
Definition: tableview_treeview.h:59
~TableViewTreeView() override
Definition: tableview_treeview.cpp:112
AbstractItemDragDropHandler * dragDropHandler() const override
Definition: tableview_treeview.cpp:250
void wheelEvent(QWheelEvent *event) override
Definition: tableview_treeview.cpp:332
QModelIndex mapIndexForDragDrop(const QModelIndex &index) const override
Definition: tableview_treeview.cpp:257
Album * albumAt(const QPoint &pos) const
Definition: tableview_treeview.cpp:315
bool hasHiddenGroupedImages(const ItemInfo &info) const override
must be implemented by parent view
Definition: tableview_treeview.cpp:355
QPixmap pixmapForDrag(const QList< QModelIndex > &indexes) const override
Definition: tableview_treeview.cpp:270
bool eventFilter(QObject *watched, QEvent *event) override
Definition: tableview_treeview.cpp:116
TableViewTreeView(TableViewShared *const tableViewShared, QWidget *const parent=nullptr)
Definition: tableview_treeview.cpp:74
#define DECLARE_VIEW_DRAG_DROP_METHODS(ParentViewClass)
Definition: dragdropimplementations.h:155
Definition: datefolderview.cpp:43