1 | // Copyright (C) 2018 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 QTESTSUPPORT_WIDGETS_H |
5 | #define QTESTSUPPORT_WIDGETS_H |
6 | |
7 | #include <QtWidgets/qtwidgetsglobal.h> |
8 | #include <QtGui/qtestsupport_gui.h> |
9 | |
10 | QT_BEGIN_NAMESPACE |
11 | |
12 | class QPointingDevice; |
13 | class QWidget; |
14 | |
15 | namespace QTest { |
16 | |
17 | [[nodiscard]] Q_WIDGETS_EXPORT bool qWaitForWindowActive(QWidget *widget, int timeout = 5000); |
18 | [[nodiscard]] Q_WIDGETS_EXPORT bool qWaitForWindowExposed(QWidget *widget, int timeout = 5000); |
19 | |
20 | class Q_WIDGETS_EXPORT QTouchEventWidgetSequence : public QTouchEventSequence |
21 | { |
22 | public: |
23 | ~QTouchEventWidgetSequence() override; |
24 | QTouchEventWidgetSequence& press(int touchId, const QPoint &pt, QWidget *widget = nullptr); |
25 | QTouchEventWidgetSequence& move(int touchId, const QPoint &pt, QWidget *widget = nullptr); |
26 | QTouchEventWidgetSequence& release(int touchId, const QPoint &pt, QWidget *widget = nullptr); |
27 | QTouchEventWidgetSequence& stationary(int touchId) override; |
28 | |
29 | bool commit(bool processEvents = true) override; |
30 | |
31 | private: |
32 | QTouchEventWidgetSequence(QWidget *widget, QPointingDevice *aDevice, bool autoCommit); |
33 | |
34 | QPoint mapToScreen(QWidget *widget, const QPoint &pt); |
35 | |
36 | QWidget *targetWidget = nullptr; |
37 | |
38 | friend QTouchEventWidgetSequence touchEvent(QWidget *widget, QPointingDevice *device, bool autoCommit); |
39 | }; |
40 | |
41 | } // namespace QTest |
42 | |
43 | QT_END_NAMESPACE |
44 | |
45 | #endif |
46 | |