digiKam
itemratingoverlay.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 : 2009-04-30
7  * Description : rating icon view item at mouse hover
8  *
9  * Copyright (C) 2009 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10  * Copyright (C) 2009-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
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_ITEM_RATING_OVERLAY_H
26 #define DIGIKAM_ITEM_RATING_OVERLAY_H
27 
28 // Qt includes
29 
30 #include <QAbstractItemView>
31 
32 // Local includes
33 
34 #include "itemdelegateoverlay.h"
35 #include "itemviewdelegate.h"
36 
37 namespace Digikam
38 {
39 
40 class RatingWidget;
41 
43 {
44  Q_OBJECT
46 
47 public:
48 
49  explicit ItemRatingOverlay(QObject* const parent);
50 
51  RatingWidget* ratingWidget() const;
52 
53 Q_SIGNALS:
54 
55  void ratingEdited(const QList<QModelIndex>& indexes, int rating);
56 
57 protected Q_SLOTS:
58 
59  void slotRatingChanged(int);
60  void slotDataChanged(const QModelIndex&, const QModelIndex&);
61 
62 protected:
63 
64  void updatePosition();
65  void updateRating();
66 
67 protected:
68 
69  QWidget* createWidget() override;
70  void setActive(bool) override;
71  void visualChange() override;
72  void hide() override;
73  void slotEntered(const QModelIndex& index) override;
74  void widgetEnterEvent() override;
75  void widgetLeaveEvent() override;
76 
77 protected:
78 
79  QPersistentModelIndex m_index;
80 };
81 
82 } // namespace Digikam
83 
84 #endif // DIGIKAM_ITEM_RATING_OVERLAY_H
Definition: itemdelegateoverlay.h:125
Definition: itemratingoverlay.h:43
QWidget * createWidget() override
Definition: itemratingoverlay.cpp:48
QPersistentModelIndex m_index
Definition: itemratingoverlay.h:79
void widgetEnterEvent() override
Definition: itemratingoverlay.cpp:92
void ratingEdited(const QList< QModelIndex > &indexes, int rating)
void slotRatingChanged(int)
Definition: itemratingoverlay.cpp:141
ItemRatingOverlay(QObject *const parent)
Definition: itemratingoverlay.cpp:38
void updateRating()
Definition: itemratingoverlay.cpp:130
void hide() override
Definition: itemratingoverlay.cpp:102
void updatePosition()
Definition: itemratingoverlay.cpp:108
RatingWidget * ratingWidget() const
Definition: itemratingoverlay.cpp:43
void setActive(bool) override
Definition: itemratingoverlay.cpp:57
void widgetLeaveEvent() override
Definition: itemratingoverlay.cpp:97
void visualChange() override
Definition: itemratingoverlay.cpp:83
void slotEntered(const QModelIndex &index) override
Definition: itemratingoverlay.cpp:151
void slotDataChanged(const QModelIndex &, const QModelIndex &)
Definition: itemratingoverlay.cpp:173
Definition: itemviewdelegate.h:42
Definition: ratingwidget.h:46
#define REQUIRE_DELEGATE(Delegate)
Definition: itemdelegateoverlay.h:112
Definition: datefolderview.cpp:43