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

Provided by KDAB

Privacy Policy
Learn Advanced QML with KDAB
Find out more

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