swift
Loading...
Searching...
No Matches
threadedtimer.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2025 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6#ifndef SWIFT_MISC_THREADED_TIMER_H
7#define SWIFT_MISC_THREADED_TIMER_H
8
9#include <QObject>
10#include <QTimer>
11
13
14namespace swift::misc
15{
18 {
20 public:
22 CThreadedTimer(QObject *owner, const QString &name, bool singleShot = false);
23
25 ~CThreadedTimer() override = default;
26
29 void startTimer(std::chrono::milliseconds ms);
30
33 void stopTimer();
34
35 signals:
37 void timeout();
38
39 private:
40 QTimer m_updateTimer { this };
41 };
42} // namespace swift::misc
43
44#endif // SWIFT_MISC_THREADED_TIMER_H
void stopTimer()
Safely stop update time.
~CThreadedTimer()=default
Destructor.
CThreadedTimer(QObject *owner, const QString &name, bool singleShot=false)
Constructor.
void startTimer(std::chrono::milliseconds ms)
Start updating (start timer).
void timeout()
Timer timed out.
Free functions in swift::misc.
auto singleShot(int msec, QObject *target, F &&task)
Starts a single-shot timer which will call a task in the thread of the given object when it times out...
Definition threadutils.h:30
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
#define SWIFT_MISC_EXPORT
Export a class or function from the library.