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
11QT_BEGIN_NAMESPACE
12
13class QQuickWindow;
14class QQuickItem;
15class QMouseEvent;
16class QKeyEvent;
17class QTouchEvent;
18class QEnterEvent;
19
20namespace QmlJSDebugger {
21
22class GlobalInspector;
23class QQuickWindowInspector;
24class HoverHighlight;
25
26class InspectTool : public QObject
27{
28 Q_OBJECT
29public:
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
42private:
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
63QT_END_NAMESPACE
64
65#endif // INSPECTTOOL_H
66

source code of qtdeclarative/src/plugins/qmltooling/qmldbg_inspector/inspecttool.h