Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
quicktestevent_p.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#ifndef QUICKTESTEVENT_P_H
6#define QUICKTESTEVENT_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQuickTest/private/quicktestglobal_p.h>
20
21#include <QtCore/qobject.h>
22#include <QtGui/QWindow>
23#include <QtQml/qqml.h>
24#include <QtTest/qtesttouch.h>
25
26QT_BEGIN_NAMESPACE
27
28class QuickTestEvent;
29class Q_QMLTEST_EXPORT QQuickTouchEventSequence : public QObject
30{
31 Q_OBJECT
32 QML_ANONYMOUS
33 QML_ADDED_IN_VERSION(1, 0)
34
35public:
36 explicit QQuickTouchEventSequence(QuickTestEvent *testEvent, QObject *item = nullptr);
37public Q_SLOTS:
38 QObject* press(int touchId, QObject *item, qreal x, qreal y);
39 QObject* move(int touchId, QObject *item, qreal x, qreal y);
40 QObject* release(int touchId, QObject *item, qreal x, qreal y);
41 QObject* stationary(int touchId);
42 QObject* commit();
43
44private:
45 QTest::QTouchEventSequence m_sequence;
46 QuickTestEvent * const m_testEvent;
47};
48
49class Q_QMLTEST_EXPORT QuickTestEvent : public QObject
50{
51 Q_OBJECT
52 Q_PROPERTY(int defaultMouseDelay READ defaultMouseDelay FINAL)
53 QML_NAMED_ELEMENT(TestEvent)
54 QML_ADDED_IN_VERSION(1, 0)
55public:
56 QuickTestEvent(QObject *parent = nullptr);
57 ~QuickTestEvent() override;
58 int defaultMouseDelay() const;
59
60public Q_SLOTS:
61 bool keyPress(int key, int modifiers, int delay);
62 bool keyRelease(int key, int modifiers, int delay);
63 bool keyClick(int key, int modifiers, int delay);
64
65 bool keyPressChar(const QString &character, int modifiers, int delay);
66 bool keyReleaseChar(const QString &character, int modifiers, int delay);
67 bool keyClickChar(const QString &character, int modifiers, int delay);
68
69 Q_REVISION(1, 2) bool keySequence(const QVariant &keySequence);
70
71 bool mousePress(QObject *item, qreal x, qreal y, int button,
72 int modifiers, int delay);
73 bool mouseRelease(QObject *item, qreal x, qreal y, int button,
74 int modifiers, int delay);
75 bool mouseClick(QObject *item, qreal x, qreal y, int button,
76 int modifiers, int delay);
77 bool mouseDoubleClick(QObject *item, qreal x, qreal y, int button,
78 int modifiers, int delay);
79 bool mouseDoubleClickSequence(QObject *item, qreal x, qreal y, int button,
80 int modifiers, int delay);
81 bool mouseMove(QObject *item, qreal x, qreal y, int delay, int buttons, int modifiers);
82
83#if QT_CONFIG(wheelevent)
84 bool mouseWheel(QObject *item, qreal x, qreal y, int buttons,
85 int modifiers, int xDelta, int yDelta, int delay);
86#endif
87
88 QQuickTouchEventSequence *touchEvent(QObject *item = nullptr);
89private:
90 QWindow *eventWindow(QObject *item = nullptr);
91 QWindow *activeWindow();
92 QPointingDevice *touchDevice();
93
94 Qt::MouseButtons m_pressedButtons;
95
96 friend class QQuickTouchEventSequence;
97};
98
99QT_END_NAMESPACE
100
101#endif
static void mouseEvent(MouseAction action, QWindow *window, QObject *item, Qt::MouseButton button, Qt::KeyboardModifiers stateKey, const QPointF &_pos, int delay=-1)