1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of Qt Creator.
7 **
8 ** Commercial License Usage
9 ** Licensees holding valid commercial Qt licenses may use this file in
10 ** accordance with the commercial license agreement provided with the
11 ** Software or, alternatively, in accordance with the terms contained in
12 ** a written agreement between you and The Qt Company. For licensing terms
13 ** and conditions see https://www.qt.io/terms-conditions. For further
14 ** information use the contact form at https://www.qt.io/contact-us.
15 **
16 ** GNU General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU
18 ** General Public License version 3 as published by the Free Software
19 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
20 ** included in the packaging of this file. Please review the following
21 ** information to ensure the GNU General Public License requirements will
22 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
23 **
24 ****************************************************************************/
25 
26 #pragma once
27 
28 #include "abstractcustomtool.h"
29 #include "selectionindicator.h"
30 
31 #include <QHash>
32 #include <QPointer>
33 #include <QColorDialog>
34 
35 #include "pathtoolview.h"
36 
37 namespace QmlDesigner {
38 
39 class PathItem;
40 
41 class PathTool : public QObject, public AbstractCustomTool
42 {
43     Q_OBJECT
44 public:
45     PathTool();
46     ~PathTool() override;
47 
48     void mousePressEvent(const QList<QGraphicsItem*> &itemList,
49                          QGraphicsSceneMouseEvent *event) override;
50     void mouseMoveEvent(const QList<QGraphicsItem*> &itemList,
51                         QGraphicsSceneMouseEvent *event) override;
52     void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList,
53                            QGraphicsSceneMouseEvent *event) override;
54     void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList,
55                                QGraphicsSceneMouseEvent *event) override;
56     void hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
57                         QGraphicsSceneMouseEvent *event) override;
58     void keyPressEvent(QKeyEvent *event) override;
59     void keyReleaseEvent(QKeyEvent *keyEvent) override;
60 
61     void dragLeaveEvent(const QList<QGraphicsItem*> &itemList,
62                         QGraphicsSceneDragDropEvent * event) override;
63     void dragMoveEvent(const QList<QGraphicsItem*> &itemList,
64                        QGraphicsSceneDragDropEvent * event) override;
65 
66     void itemsAboutToRemoved(const QList<FormEditorItem*> &itemList) override;
67 
68     void selectedItemsChanged(const QList<FormEditorItem*> &itemList) override;
69 
70     void instancesCompleted(const QList<FormEditorItem*> &itemList) override;
71     void instancesParentChanged(const QList<FormEditorItem *> &itemList) override;
72     void instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList) override;
73 
74     void clear() override;
75 
76     void formEditorItemsChanged(const QList<FormEditorItem*> &itemList) override;
77 
78     int wantHandleItem(const ModelNode &modelNode) const override;
79 
80     QString name() const override;
81 
82     ModelNode editingPathViewModelNode() const;
83 
84     void pathChanged();
85 
86 private:
87     PathToolView m_pathToolView;
88     QPointer<PathItem> m_pathItem;
89 };
90 
91 }
92