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
10QT_BEGIN_NAMESPACE
11
12class QPointingDevice;
13class QWidget;
14
15namespace QTest {
16
17[[nodiscard]] Q_WIDGETS_EXPORT bool qWaitForWindowActive(QWidget *widget, int timeout);
18[[nodiscard]] Q_WIDGETS_EXPORT bool qWaitForWindowActive(QWidget *widget, QDeadlineTimer timeout);
19[[nodiscard]] Q_WIDGETS_EXPORT bool qWaitForWindowActive(QWidget *widget);
20
21[[nodiscard]] Q_WIDGETS_EXPORT bool qWaitForWindowFocused(QWidget *widget, QDeadlineTimer timeout);
22[[nodiscard]] Q_WIDGETS_EXPORT bool qWaitForWindowFocused(QWidget *widget);
23
24[[nodiscard]] Q_WIDGETS_EXPORT bool qWaitForWindowExposed(QWidget *widget, int timeout);
25[[nodiscard]] Q_WIDGETS_EXPORT bool qWaitForWindowExposed(QWidget *widget, QDeadlineTimer timeout);
26[[nodiscard]] Q_WIDGETS_EXPORT bool qWaitForWindowExposed(QWidget *widget);
27
28class Q_WIDGETS_EXPORT QTouchEventWidgetSequence : public QTouchEventSequence
29{
30public:
31 ~QTouchEventWidgetSequence() override;
32 QTouchEventWidgetSequence& press(int touchId, const QPoint &pt, QWidget *widget = nullptr);
33 QTouchEventWidgetSequence& move(int touchId, const QPoint &pt, QWidget *widget = nullptr);
34 QTouchEventWidgetSequence& release(int touchId, const QPoint &pt, QWidget *widget = nullptr);
35 QTouchEventWidgetSequence& stationary(int touchId) override;
36
37 bool commit(bool processEvents = true) override;
38
39private:
40 QTouchEventWidgetSequence(QWidget *widget, QPointingDevice *aDevice, bool autoCommit);
41
42 QPoint mapToScreen(QWidget *widget, const QPoint &pt);
43
44 QWidget *targetWidget = nullptr;
45
46 friend QTouchEventWidgetSequence touchEvent(QWidget *widget, QPointingDevice *device, bool autoCommit);
47};
48
49} // namespace QTest
50
51QT_END_NAMESPACE
52
53#endif
54

source code of qtbase/src/widgets/kernel/qtestsupport_widgets.h