Files
o3de/Code/Framework/AzToolsFramework/AzToolsFramework/Application/Ticker.h
T
Steve Pham 38261d0800 Shorten copyright headers by splitting into 2 lines (#2213)
* Updated all copyright headers to split the longer original copyright line into 2 shorter lines

Signed-off-by: Steve Pham <spham@amazon.com>
2021-07-16 15:25:48 -07:00

55 lines
1.2 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#if !defined(Q_MOC_RUN)
#include <QtCore/QObject>
#include <QtCore/QTimer>
#include <QtCore/QThread>
#include <AzCore/Memory/SystemAllocator.h>
#endif
#pragma once
namespace AzToolsFramework
{
//! Qt suppresses all timer events during modal dialogs, this object allows us to
//! emit a Tick event from which we can broadcast a SystemTick event.
class Ticker
: public QObject
{
public:
Q_OBJECT
public:
explicit Ticker(QObject* parent = nullptr, float timeoutMS = 10.f);
virtual ~Ticker();
//! Starts the ticking on a thread
void Start();
//! Cancels and destroys the ticking thread
void Cancel();
Q_SIGNALS:
//! Connect to this signal to handle the tick
void Tick();
private Q_SLOTS:
//! Single shot event that emits the Tick signal
void Loop();
private:
QThread* m_thread;
bool m_cancelled;
float m_timeoutMS;
};
}