digiKam
clickdragreleaseitem.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 : 2011-03-04
7  * Description : A simple item to click, drag and release
8  *
9  * Copyright (C) 2010-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
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_CLICK_DRAG_RELEASE_ITEM_H
25 #define DIGIKAM_CLICK_DRAG_RELEASE_ITEM_H
26 
27 // Qt includes
28 
29 #include <QGraphicsObject>
30 
31 // Local includes
32 
33 #include "digikam_export.h"
34 
35 namespace Digikam
36 {
37 
38 class DIGIKAM_EXPORT ClickDragReleaseItem : public QGraphicsObject // clazy:exclude=ctor-missing-parent-argument
39 {
40  Q_OBJECT
41 
42 public:
43 
44  explicit ClickDragReleaseItem(QGraphicsItem* const parent);
45  ~ClickDragReleaseItem() override;
46 
47  QRectF boundingRect() const override;
48  void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
49 
50 Q_SIGNALS:
51 
59  void started(const QPointF& pos);
60  void moving(const QRectF& rect);
61  void finished(const QRectF& rect);
62  void cancelled();
63 
64 protected:
65 
66  void mousePressEvent(QGraphicsSceneMouseEvent*) override;
67  void mouseMoveEvent(QGraphicsSceneMouseEvent*) override;
68  void mouseReleaseEvent(QGraphicsSceneMouseEvent*) override;
69  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*) override;
70  void hoverMoveEvent(QGraphicsSceneHoverEvent*) override;
71  void keyPressEvent(QKeyEvent*) override;
72 
73 private:
74 
75  class Private;
76  Private* const d;
77 };
78 
79 } // namespace Digikam
80 
81 #endif // DIGIKAM_CLICK_DRAG_RELEASE_ITEM_H
Definition: clickdragreleaseitem.h:39
void moving(const QRectF &rect)
void finished(const QRectF &rect)
void started(const QPointF &pos)
Definition: datefolderview.cpp:43