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        : 2009-04-30
0007  * Description : rejection icon view item on 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_FACE_REJECTION_OVERLAY_H
0016 #define DIGIKAM_FACE_REJECTION_OVERLAY_H
0017 
0018 // Qt includes
0019 
0020 #include <QAbstractItemView>
0021 
0022 // Local includes
0023 
0024 #include "itemviewhoverbutton.h"
0025 #include "itemdelegateoverlay.h"
0026 #include "iteminfo.h"
0027 
0028 namespace Digikam
0029 {
0030 
0031 class FaceRejectionOverlayButton : public ItemViewHoverButton
0032 {
0033     Q_OBJECT
0034 
0035 public:
0036 
0037     explicit FaceRejectionOverlayButton(QAbstractItemView* const parentView);
0038     QSize sizeHint() const  override;
0039 
0040 protected:
0041 
0042     QIcon icon()            override;
0043     void updateToolTip()    override;
0044 };
0045 
0046 // --------------------------------------------------------------------
0047 
0048 class FaceRejectionOverlay : public HoverButtonDelegateOverlay
0049 {
0050     Q_OBJECT
0051 
0052 public:
0053 
0054     explicit FaceRejectionOverlay(QObject* const parent);
0055     void setActive(bool active)                     override;
0056 
0057 Q_SIGNALS:
0058 
0059     void rejectFaces(const QList<QModelIndex>& indexes);
0060 
0061 protected:
0062 
0063     ItemViewHoverButton* createButton()             override;
0064     void updateButton(const QModelIndex& index)     override;
0065     bool checkIndex(const QModelIndex& index) const override;
0066     void widgetEnterEvent()                         override;
0067     void widgetLeaveEvent()                         override;
0068 
0069 protected Q_SLOTS:
0070 
0071     void slotClicked();
0072 };
0073 
0074 } // namespace Digikam
0075 
0076 #endif // DIGIKAM_FACE_REJECTION_OVERLAY_H