digiKam
Loading...
Searching...
No Matches
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 * SPDX-FileCopyrightText: 2007 by Rafael Fernández López <ereslibre at kde dot org>
10 * SPDX-FileCopyrightText: 2009-2012 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
11 * SPDX-FileCopyrightText: 2011-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
12 *
13 * SPDX-License-Identifier: GPL-2.0-or-later
14 *
15 * ============================================================ */
16
17#pragma once
18
19// Qt includes
20
21#include <QObject>
22#include <QMouseEvent>
23
24// Local includes
25
26#include "digikam_export.h"
27
28class QPainter;
29class QModelIndex;
30class QStyleOption;
31
32namespace Digikam
33{
34
35class DCategorizedView;
36
41class DIGIKAM_EXPORT DCategoryDrawer : public QObject // clazy:exclude=ctor-missing-parent-argument
42{
43 Q_OBJECT
44
45 friend class DCategorizedView;
46
47public:
53 explicit DCategoryDrawer(DCategorizedView* const view);
54 ~DCategoryDrawer() override;
55
59 DCategorizedView* view() const;
60
68 virtual void drawCategory(const QModelIndex& index,
69 int sortRole,
70 const QStyleOption& option,
71 QPainter* painter) const;
72
77 virtual int categoryHeight(const QModelIndex& index,
78 const QStyleOption& option) const;
79
83 virtual int leftMargin() const;
84
88 virtual int rightMargin() const;
89
90Q_SIGNALS:
91
95 void collapseOrExpandClicked(const QModelIndex& index);
96
104 void actionRequested(int action, const QModelIndex& index);
105
106protected:
107
119 virtual void mouseButtonPressed(const QModelIndex& index, const QRect& blockRect, QMouseEvent* event);
120
132 virtual void mouseButtonReleased(const QModelIndex& index, const QRect& blockRect, QMouseEvent* event);
133
141 virtual void mouseMoved(const QModelIndex& index, const QRect& blockRect, QMouseEvent* event);
142
154 virtual void mouseButtonDoubleClicked(const QModelIndex& index, const QRect& blockRect, QMouseEvent* event);
155
162 virtual void mouseLeft(const QModelIndex& index, const QRect& blockRect);
163
164private:
165
166 class Private;
167 Private* const d = nullptr;
168};
169
170} // namespace Digikam
Item view for listing items.
Definition dcategorizedview.h:39
Definition dcategorydrawer.h:42
void collapseOrExpandClicked(const QModelIndex &index)
void actionRequested(int action, const QModelIndex &index)
Definition datefolderview.cpp:34