| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef INSPECTTOOL_H |
| 5 | #define INSPECTTOOL_H |
| 6 | |
| 7 | #include <QtCore/QPointF> |
| 8 | #include <QtCore/QPointer> |
| 9 | #include <QtCore/QTimer> |
| 10 | |
| 11 | QT_BEGIN_NAMESPACE |
| 12 | |
| 13 | class QQuickWindow; |
| 14 | class QQuickItem; |
| 15 | class QMouseEvent; |
| 16 | class QKeyEvent; |
| 17 | class QTouchEvent; |
| 18 | class QEnterEvent; |
| 19 | |
| 20 | namespace QmlJSDebugger { |
| 21 | |
| 22 | class GlobalInspector; |
| 23 | class QQuickWindowInspector; |
| 24 | class HoverHighlight; |
| 25 | |
| 26 | class InspectTool : public QObject |
| 27 | { |
| 28 | Q_OBJECT |
| 29 | public: |
| 30 | InspectTool(QQuickWindowInspector *inspector, QQuickWindow *view); |
| 31 | |
| 32 | void enterEvent(QEnterEvent *); |
| 33 | void leaveEvent(QEvent *); |
| 34 | void mousePressEvent(QMouseEvent *); |
| 35 | void mouseMoveEvent(QMouseEvent *); |
| 36 | void mouseDoubleClickEvent(QMouseEvent *); |
| 37 | void hoverMoveEvent(QMouseEvent *); |
| 38 | void keyPressEvent(QKeyEvent *) {} |
| 39 | void keyReleaseEvent(QKeyEvent *); |
| 40 | void touchEvent(QTouchEvent *event); |
| 41 | |
| 42 | private: |
| 43 | void selectNextItem(); |
| 44 | void selectItem(); |
| 45 | void showItemName(); |
| 46 | |
| 47 | QQuickWindowInspector *inspector() const; |
| 48 | GlobalInspector *globalInspector() const; |
| 49 | |
| 50 | bool m_tapEvent; |
| 51 | QPointer<QQuickItem> m_contentItem; |
| 52 | QPointF m_mousePosition; |
| 53 | ulong m_touchTimestamp; |
| 54 | QTimer m_nameDisplayTimer; |
| 55 | |
| 56 | HoverHighlight *m_hoverHighlight; |
| 57 | QQuickItem *m_lastItem; |
| 58 | QQuickItem *m_lastClickedItem; |
| 59 | }; |
| 60 | |
| 61 | } // namespace QmlJSDebugger |
| 62 | |
| 63 | QT_END_NAMESPACE |
| 64 | |
| 65 | #endif // INSPECTTOOL_H |
| 66 |
