digiKam
Loading...
Searching...
No Matches
itemviewhoverbutton.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 : Qt item view mouse hover button
8 *
9 * SPDX-FileCopyrightText: 2009-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10 *
11 * SPDX-License-Identifier: GPL-2.0-or-later
12 *
13 * ============================================================ */
14
15#pragma once
16
17// Qt includes
18
19#include <QAbstractButton>
20#include <QAbstractItemView>
21
22// Local includes
23
24#include "digikam_export.h"
25
26class QTimeLine;
27
28namespace Digikam
29{
30
31class DIGIKAM_EXPORT ItemViewHoverButton : public QAbstractButton
32{
33 Q_OBJECT
34
35public:
36
37 explicit ItemViewHoverButton(QAbstractItemView* const parentView);
38
39 void initIcon();
40 void reset();
41 void setIndex(const QModelIndex& index);
42 QModelIndex index() const;
43 void setVisible(bool visible) override;
44
48 QSize sizeHint() const override = 0;
49
50protected:
51
55 void setup();
56
57#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
58
59 void enterEvent(QEnterEvent* event);
60
61#else
62
63 void enterEvent(QEvent* event);
64
65#endif
66
67 void leaveEvent(QEvent* event);
68 void paintEvent(QPaintEvent* event);
69
73 virtual QIcon icon() = 0;
74
78 virtual void updateToolTip();
79
80protected Q_SLOTS:
81
82 void setFadingValue(int value);
83 void refreshIcon();
84 void startFading();
85 void stopFading();
86
87protected:
88
89 QPersistentModelIndex m_index;
90 bool m_isHovered = false;
91 int m_fadingValue = 0;
92 QIcon m_icon;
93 QTimeLine* m_fadingTimeLine = nullptr;
94};
95
96} // namespace Digikam
Definition itemviewhoverbutton.h:32
QSize sizeHint() const override=0
QIcon m_icon
Definition itemviewhoverbutton.h:92
QPersistentModelIndex m_index
Definition itemviewhoverbutton.h:89
qulonglong value
Definition itemviewutilities.cpp:585
Definition datefolderview.cpp:34