Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/QtGui/qtestsupport_gui.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright (C) 2018 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QTESTSUPPORT_GUI_H
0005 #define QTESTSUPPORT_GUI_H
0006 
0007 #include <QtGui/qtguiglobal.h>
0008 #include <QtGui/qevent.h>
0009 #include <QtCore/qmap.h>
0010 
0011 QT_BEGIN_NAMESPACE
0012 
0013 class QWindow;
0014 
0015 Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *w, const QPointingDevice *device,
0016                                 const QList<QEventPoint> &points,
0017                                 Qt::KeyboardModifiers mods = Qt::NoModifier);
0018 
0019 Q_GUI_EXPORT bool qt_handleTouchEventv2(QWindow *w, const QPointingDevice *device,
0020                                 const QList<QEventPoint> &points,
0021                                 Qt::KeyboardModifiers mods = Qt::NoModifier);
0022 
0023 namespace QTest {
0024 
0025 [[nodiscard]] Q_GUI_EXPORT bool qWaitForWindowActive(QWindow *window, int timeout = 5000);
0026 [[nodiscard]] Q_GUI_EXPORT bool qWaitForWindowFocused(QWindow *widget, QDeadlineTimer timeout = std::chrono::seconds{5});
0027 [[nodiscard]] Q_GUI_EXPORT bool qWaitForWindowExposed(QWindow *window, int timeout = 5000);
0028 
0029 Q_GUI_EXPORT QPointingDevice * createTouchDevice(QInputDevice::DeviceType devType = QInputDevice::DeviceType::TouchScreen,
0030                                                  QInputDevice::Capabilities caps = QInputDevice::Capability::Position);
0031 
0032 class Q_GUI_EXPORT QTouchEventSequence
0033 {
0034 public:
0035     virtual ~QTouchEventSequence();
0036     QTouchEventSequence& press(int touchId, const QPoint &pt, QWindow *window = nullptr);
0037     QTouchEventSequence& move(int touchId, const QPoint &pt, QWindow *window = nullptr);
0038     QTouchEventSequence& release(int touchId, const QPoint &pt, QWindow *window = nullptr);
0039     virtual QTouchEventSequence& stationary(int touchId);
0040 
0041     virtual bool commit(bool processEvents = true);
0042 
0043 protected:
0044     QTouchEventSequence(QWindow *window, QPointingDevice *aDevice, bool autoCommit);
0045 
0046     QPoint mapToScreen(QWindow *window, const QPoint &pt);
0047 
0048     QEventPoint &point(int touchId);
0049 
0050     QEventPoint &pointOrPreviousPoint(int touchId);
0051 
0052     QMap<int, QEventPoint> previousPoints;
0053     QMap<int, QEventPoint> points;
0054     QWindow *targetWindow;
0055     QPointingDevice *device;
0056     bool commitWhenDestroyed;
0057     friend QTouchEventSequence touchEvent(QWindow *window, QPointingDevice *device, bool autoCommit);
0058 };
0059 
0060 } // namespace QTest
0061 
0062 QT_END_NAMESPACE
0063 
0064 #endif