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

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2009-04-30
0007  * Description : selection icon view item at mouse hover
0008  *
0009  * SPDX-FileCopyrightText: 2009-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_ITEM_SELECTION_OVERLAY_H
0016 #define DIGIKAM_ITEM_SELECTION_OVERLAY_H
0017 
0018 // Qt includes
0019 
0020 #include <QAbstractItemView>
0021 
0022 // Local includes
0023 
0024 #include "itemviewhoverbutton.h"
0025 #include "itemdelegateoverlay.h"
0026 
0027 namespace Digikam
0028 {
0029 
0030 class ItemSelectionOverlayButton : public ItemViewHoverButton
0031 {
0032     Q_OBJECT
0033 
0034 public:
0035 
0036     explicit ItemSelectionOverlayButton(QAbstractItemView* const parentView);
0037     QSize sizeHint() const  override;
0038 
0039 protected:
0040 
0041     QIcon icon()            override;
0042     void updateToolTip()    override;
0043 };
0044 
0045 // --------------------------------------------------------------------
0046 
0047 class ItemSelectionOverlay : public HoverButtonDelegateOverlay
0048 {
0049     Q_OBJECT
0050 
0051 public:
0052 
0053     explicit ItemSelectionOverlay(QObject* const parent);
0054     void setActive(bool active)                 override;
0055 
0056 protected:
0057 
0058     ItemViewHoverButton* createButton()         override;
0059     void updateButton(const QModelIndex& index) override;
0060 
0061 protected Q_SLOTS:
0062 
0063     void slotClicked(bool checked);
0064     void slotSelectionChanged(const QItemSelection&, const QItemSelection&);
0065 };
0066 
0067 } // namespace Digikam
0068 
0069 #endif // DIGIKAM_ITEM_SELECTION_OVERLAY_H