digiKam
dcategorydrawer.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-01-16
7  * Description : drawing item view based on DCategorizedView
8  *
9  * Copyright (C) 2007 by Rafael Fernández López <ereslibre at kde dot org>
10  * Copyright (C) 2009-2012 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
11  * Copyright (C) 2011-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option)
17  * any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_DCATEGORY_DRAWER_H
27 #define DIGIKAM_DCATEGORY_DRAWER_H
28 
29 // Qt includes
30 
31 #include <QObject>
32 #include <QMouseEvent>
33 
34 // Local includes
35 
36 #include "digikam_export.h"
37 
38 class QPainter;
39 class QModelIndex;
40 class QStyleOption;
41 
42 namespace Digikam
43 {
44 
45 class DCategorizedView;
46 
51 class DIGIKAM_EXPORT DCategoryDrawer : public QObject // clazy:exclude=ctor-missing-parent-argument
52 {
53  Q_OBJECT
54 
55  friend class DCategorizedView;
56 
57 public:
63  explicit DCategoryDrawer(DCategorizedView* const view);
64  ~DCategoryDrawer() override;
65 
69  DCategorizedView* view() const;
70 
78  virtual void drawCategory(const QModelIndex& index,
79  int sortRole,
80  const QStyleOption& option,
81  QPainter* painter) const;
82 
87  virtual int categoryHeight(const QModelIndex& index,
88  const QStyleOption& option) const;
89 
93  virtual int leftMargin() const;
94 
98  virtual int rightMargin() const;
99 
100 Q_SIGNALS:
101 
105  void collapseOrExpandClicked(const QModelIndex& index);
106 
114  void actionRequested(int action, const QModelIndex& index);
115 
116 protected:
117 
129  virtual void mouseButtonPressed(const QModelIndex& index, const QRect& blockRect, QMouseEvent* event);
130 
142  virtual void mouseButtonReleased(const QModelIndex& index, const QRect& blockRect, QMouseEvent* event);
143 
151  virtual void mouseMoved(const QModelIndex& index, const QRect& blockRect, QMouseEvent* event);
152 
164  virtual void mouseButtonDoubleClicked(const QModelIndex& index, const QRect& blockRect, QMouseEvent* event);
165 
172  virtual void mouseLeft(const QModelIndex& index, const QRect& blockRect);
173 
174 private:
175 
176  class Private;
177  Private* const d;
178 };
179 
180 } // namespace Digikam
181 
182 #endif // DIGIKAM_DCATEGORY_DRAWER_H
Item view for listing items.
Definition: dcategorizedview.h:49
Definition: dcategorydrawer.h:52
void collapseOrExpandClicked(const QModelIndex &index)
void actionRequested(int action, const QModelIndex &index)
Definition: datefolderview.cpp:43