swift
src
misc
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
12
#include "
misc/swiftmiscexport.h
"
13
14
namespace
swift::misc
15
{
17
class
SWIFT_MISC_EXPORT
CThreadedTimer
:
public
QObject
18
{
19
Q_OBJECT
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
swift::misc::CThreadedTimer
Thread-safe timer class.
Definition:
threadedtimer.h:18
swift::misc::CThreadedTimer::~CThreadedTimer
~CThreadedTimer()=default
Destructor.
swift::misc::CThreadedTimer::timeout
void timeout()
Timer timed out.
swift::misc
Free functions in swift::misc.
Definition:
aircraftmatcher.h:22
swift::misc::singleShot
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
QString
QTimer
swiftmiscexport.h
SWIFT_MISC_EXPORT
#define SWIFT_MISC_EXPORT
Export a class or function from the library.
Definition:
swiftmiscexport.h:19
Generated on Sun Oct 12 2025 20:05:13 for swift by
1.9.1