File indexing completed on 2025-01-05 03:51:10

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2014-05-28
0007  * Description : overlay for GPS location indicator
0008  *
0009  * SPDX-FileCopyrightText: 2014-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_ITEM_COORDINATES_OVERLAY_H
0016 #define DIGIKAM_ITEM_COORDINATES_OVERLAY_H
0017 
0018 // Qt includes
0019 
0020 #include <QAbstractButton>
0021 #include <QAbstractItemView>
0022 
0023 // Local includes
0024 
0025 #include "itemviewhoverbutton.h"
0026 #include "itemdelegateoverlay.h"
0027 #include "itemviewdelegate.h"
0028 
0029 namespace Digikam
0030 {
0031 
0032 class CoordinatesOverlayWidget : public QAbstractButton
0033 {
0034     Q_OBJECT
0035 
0036 public:
0037 
0038     explicit CoordinatesOverlayWidget(QWidget* const parent = nullptr);
0039 
0040 protected:
0041 
0042     void paintEvent(QPaintEvent*) override;
0043 };
0044 
0045 // ----------------------------------------------------------------------
0046 
0047 class ItemCoordinatesOverlay : public AbstractWidgetDelegateOverlay
0048 {
0049     Q_OBJECT
0050     REQUIRE_DELEGATE(ItemViewDelegate)
0051 
0052 public:
0053 
0054     explicit ItemCoordinatesOverlay(QObject* const parent);
0055     CoordinatesOverlayWidget* buttonWidget() const;
0056 
0057 protected:
0058 
0059     void updatePosition();
0060 
0061     QWidget* createWidget() override;
0062     void setActive(bool active) override;
0063     void visualChange() override;
0064     bool checkIndex(const QModelIndex& index) const override;
0065     void slotEntered(const QModelIndex& index) override;
0066 
0067 protected:
0068 
0069     QPersistentModelIndex m_index;
0070 };
0071 
0072 } // namespace Digikam
0073 
0074 #endif // DIGIKAM_ITEM_COORDINATES_OVERLAY_H