KQuickImageEditor

resizerectangle.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2020 Carl Schwan <[email protected]>
3  *
4  * SPDX-License-Identifier: LGPL-2.1-or-later
5  */
6 
7 #pragma once
8 
9 #include "resizehandle.h"
10 
11 #include <QQmlComponent>
12 #include <QQuickItem>
13 
14 /// \deprecated
16 {
17  Q_OBJECT
18 
19  Q_PROPERTY(qreal insideX READ insideX WRITE setInsideX NOTIFY insideXChanged)
20  Q_PROPERTY(qreal insideY READ insideY WRITE setInsideY NOTIFY insideYChanged)
21  Q_PROPERTY(qreal insideWidth READ insideWidth WRITE setInsideWidth NOTIFY insideWidthChanged)
22  Q_PROPERTY(qreal insideHeight READ insideHeight WRITE setInsideHeight NOTIFY insideHeightChanged)
23 
24 public:
25  ResizeRectangle(QQuickItem *parent = nullptr);
26  ~ResizeRectangle() = default;
27 
28  qreal insideX() const;
29  void setInsideX(qreal x);
30  qreal insideY() const;
31  void setInsideY(qreal y);
32  qreal insideWidth() const;
33  void setInsideWidth(qreal width);
34  qreal insideHeight() const;
35  void setInsideHeight(qreal height);
36 
37  virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
38 
39 protected:
40  void mouseReleaseEvent(QMouseEvent *event) override;
41  void mousePressEvent(QMouseEvent *event) override;
42  void mouseMoveEvent(QMouseEvent *event) override;
43  void mouseDoubleClickEvent(QMouseEvent *event) override;
44  virtual void componentComplete() override;
45 
46 Q_SIGNALS:
47  /// Double click event signal
48  void acceptSize();
49  void insideXChanged();
50  void insideYChanged();
51  void insideWidthChanged();
52  void insideHeightChanged();
53  void handleComponentChanged();
54 
55 private:
56  void updateHandles();
57 
58  qreal m_insideX;
59  qreal m_insideY;
60  qreal m_insideWidth;
61  qreal m_insideHeight;
62  QPointF m_mouseDownPosition;
63  QPointF m_mouseDownGeometry;
64  bool m_mouseClickedOnRectangle = false;
65  QQmlComponent *m_handleComponent = nullptr;
66  ResizeHandle *m_handleBottomLeft = nullptr;
67  ResizeHandle *m_handleBottomRight = nullptr;
68  ResizeHandle *m_handleTopLeft = nullptr;
69  ResizeHandle *m_handleTopRight = nullptr;
70 };
qreal height() const const
Q_SIGNALSQ_SIGNALS
Q_OBJECTQ_OBJECT
qreal x() const const
Q_PROPERTY(...)
virtual bool event(QEvent *ev) override
void acceptSize()
Double click event signal.
qreal y() const const
qreal width() const const
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Oct 18 2021 23:08:19 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.