File indexing completed on 2025-01-05 03:58:06

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2010-07-23
0007  * Description : face marquer widget for FacesEngine Demo
0008  *
0009  * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText:      2010 by Adrien Bustany <madcat at mymadcat dot com>
0011  * SPDX-FileCopyrightText:      2010 by Aditya Bhatt <adityabhatt1991 at gmail dot com>
0012  *
0013  * SPDX-License-Identifier: GPL-2.0-or-later
0014  *
0015  * ============================================================ */
0016 
0017 #ifndef DIGIKAM_FACE_ENGINE_DEMO_MARQUEE_H
0018 #define DIGIKAM_FACE_ENGINE_DEMO_MARQUEE_H
0019 
0020 // Qt includes
0021 
0022 #include <QObject>
0023 #include <QRectF>
0024 #include <QGraphicsItemGroup>
0025 #include <QGraphicsItem>
0026 #include <QGraphicsSceneMouseEvent>
0027 
0028 namespace FaceEngineDemo
0029 {
0030 
0031 class FancyRect;
0032 
0033 class Marquee : public QObject,
0034                 public QGraphicsItemGroup
0035 {
0036     Q_OBJECT
0037 
0038 public:
0039 
0040     explicit Marquee(FancyRect* const rect, QGraphicsItem* const parent = nullptr);
0041     ~Marquee() override;
0042 
0043     QRectF boundingRect() const override;
0044     QRectF toRectF()      const;
0045 
0046 Q_SIGNALS:
0047 
0048     void selected(Marquee* m);
0049     void changed();
0050     void entered();
0051     void left();
0052 
0053 protected:
0054 
0055     void mousePressEvent(QGraphicsSceneMouseEvent* e)   override;
0056     void mouseMoveEvent(QGraphicsSceneMouseEvent* e)    override;
0057     void mouseReleaseEvent(QGraphicsSceneMouseEvent* e) override;
0058 
0059 private:
0060 
0061     void createHandles();
0062     void placeHandles();
0063     void placeLabel();
0064 
0065 private:
0066 
0067     // Disable
0068     explicit Marquee(QObject*);
0069 
0070     class Private;
0071     Private* const d;
0072 };
0073 
0074 } // namespace FaceEngineDemo
0075 
0076 #endif // DIGIKAM_FACE_ENGINE_DEMO_MARQUEE_H