digiKam
itemcoordinatesoverlay.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 : 2014-05-28
7  * Description : overlay for GPS location indicator
8  *
9  * Copyright (C) 2014-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * 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_ITEM_COORDINATES_OVERLAY_H
25 #define DIGIKAM_ITEM_COORDINATES_OVERLAY_H
26 
27 // Qt includes
28 
29 #include <QAbstractButton>
30 #include <QAbstractItemView>
31 
32 // Local includes
33 
34 #include "itemviewhoverbutton.h"
35 #include "itemdelegateoverlay.h"
36 #include "itemviewdelegate.h"
37 
38 namespace Digikam
39 {
40 
41 class CoordinatesOverlayWidget : public QAbstractButton
42 {
43  Q_OBJECT
44 
45 public:
46 
47  explicit CoordinatesOverlayWidget(QWidget* const parent = nullptr);
48 
49 protected:
50 
51  void paintEvent(QPaintEvent*) override;
52 };
53 
54 // ----------------------------------------------------------------------
55 
57 {
58  Q_OBJECT
60 
61 public:
62 
63  explicit ItemCoordinatesOverlay(QObject* const parent);
65 
66 protected:
67 
68  void updatePosition();
69 
70  QWidget* createWidget() override;
71  void setActive(bool active) override;
72  void visualChange() override;
73  bool checkIndex(const QModelIndex& index) const override;
74  void slotEntered(const QModelIndex& index) override;
75 
76 protected:
77 
78  QPersistentModelIndex m_index;
79 };
80 
81 } // namespace Digikam
82 
83 #endif // DIGIKAM_ITEM_COORDINATES_OVERLAY_H
Definition: itemdelegateoverlay.h:125
Definition: itemcoordinatesoverlay.h:42
CoordinatesOverlayWidget(QWidget *const parent=nullptr)
Definition: itemcoordinatesoverlay.cpp:39
void paintEvent(QPaintEvent *) override
Definition: itemcoordinatesoverlay.cpp:44
Definition: itemcoordinatesoverlay.h:57
void slotEntered(const QModelIndex &index) override
Definition: itemcoordinatesoverlay.cpp:111
bool checkIndex(const QModelIndex &index) const override
Definition: itemcoordinatesoverlay.cpp:95
QPersistentModelIndex m_index
Definition: itemcoordinatesoverlay.h:78
void visualChange() override
Definition: itemcoordinatesoverlay.cpp:72
ItemCoordinatesOverlay(QObject *const parent)
Definition: itemcoordinatesoverlay.cpp:50
QWidget * createWidget() override
Definition: itemcoordinatesoverlay.cpp:60
CoordinatesOverlayWidget * buttonWidget() const
Definition: itemcoordinatesoverlay.cpp:55
void updatePosition()
Definition: itemcoordinatesoverlay.cpp:80
void setActive(bool active) override
Definition: itemcoordinatesoverlay.cpp:67
Definition: itemviewdelegate.h:42
#define REQUIRE_DELEGATE(Delegate)
Definition: itemdelegateoverlay.h:112
Definition: datefolderview.cpp:43