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 = 5000);
18[[nodiscard]] Q_WIDGETS_EXPORT bool qWaitForWindowExposed(QWidget *widget, int timeout = 5000);
19
20class Q_WIDGETS_EXPORT QTouchEventWidgetSequence : public QTouchEventSequence
21{
22public:
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
31private:
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
43QT_END_NAMESPACE
44
45#endif
46

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