2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2016-08-17 15:29:37 +02:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
|
|
#include <chrono>
|
|
|
|
|
|
|
|
|
|
class EventSpy : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
EventSpy(uint eventType);
|
|
|
|
|
|
|
|
|
|
bool waitForEvent();
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
bool event(QEvent *event) override;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool shouldRun() const;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
std::chrono::steady_clock::time_point startTime;
|
|
|
|
|
uint eventType;
|
|
|
|
|
bool eventHappened = false;
|
|
|
|
|
};
|