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 <QFileDialog> 34 35 namespace QmlDesigner { 36 37 class SelectionContext; 38 39 class SourceTool : public QObject, public AbstractCustomTool 40 { 41 Q_OBJECT 42 public: 43 SourceTool(); 44 ~SourceTool() override; 45 46 void mousePressEvent(const QList<QGraphicsItem*> &itemList, 47 QGraphicsSceneMouseEvent *event) override; 48 void mouseMoveEvent(const QList<QGraphicsItem*> &itemList, 49 QGraphicsSceneMouseEvent *event) override; 50 void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList, 51 QGraphicsSceneMouseEvent *event) override; 52 void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, 53 QGraphicsSceneMouseEvent *event) override; 54 void hoverMoveEvent(const QList<QGraphicsItem*> &itemList, 55 QGraphicsSceneMouseEvent *event) override; 56 void keyPressEvent(QKeyEvent *event) override; 57 void keyReleaseEvent(QKeyEvent *keyEvent) override; 58 59 void dragLeaveEvent(const QList<QGraphicsItem*> &itemList, 60 QGraphicsSceneDragDropEvent * event) override; 61 void dragMoveEvent(const QList<QGraphicsItem*> &itemList, 62 QGraphicsSceneDragDropEvent * event) override; 63 64 void itemsAboutToRemoved(const QList<FormEditorItem*> &itemList) override; 65 66 void selectedItemsChanged(const QList<FormEditorItem*> &itemList) override; 67 68 void instancesCompleted(const QList<FormEditorItem*> &itemList) override; 69 void instancesParentChanged(const QList<FormEditorItem *> &itemList) override; 70 void instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList) override; 71 72 void clear() override; 73 74 void formEditorItemsChanged(const QList<FormEditorItem*> &itemList) override; 75 76 int wantHandleItem(const ModelNode &modelNode) const override; 77 78 QString name() const override; 79 80 private: 81 /* private methods */ 82 void fileSelected(const QString &fileName); 83 84 85 /* members */ 86 FormEditorItem *m_formEditorItem = nullptr; 87 QString m_oldFileName; 88 }; 89 90 } 91