5#ifndef QSINGLESHOTTIMER_P_H
6#define QSINGLESHOTTIMER_P_H
22#include "private/qnumeric_p.h"
40 const QObject *
r,
const char *member);
49 using namespace std::chrono;
50 using ratio = std::ratio_divide<std::milli, Duration::period>;
51 static_assert(ratio::den == 1);
54 if (qMulOverflow<ratio::num>(ms.count(), &
r)) {
55 qWarning(
"QTimer::singleShot(std::chrono::milliseconds, ...): "
56 "interval argument overflowed when converted to nanoseconds.");
57 return Duration::max();
69 const QObject *
r,
const char *member)
111 auto invokable = [
this,
deadline, timerType] {
std::chrono::nanoseconds Duration
A {std::chrono::duration} type that is used in various API in this class.
static QCoreApplication * instance() noexcept
Returns a pointer to the application's QCoreApplication (or QGuiApplication/QApplication) instance.
void aboutToQuit(QPrivateSignal)
This signal is emitted when the application is about to quit the main event loop, e....
bool hasExpired() const noexcept
Returns true if this QDeadlineTimer object has expired, false if there remains time left.
std::chrono::nanoseconds remainingTimeAsDuration() const noexcept
Returns the time remaining before the deadline.
static QMetaObject::Connection connectImpl(const QObject *sender, int signal_index, const QObject *receiver, void **slot, QtPrivate::QSlotObjectBase *slotObj, int type, const int *types, const QMetaObject *senderMetaObject)
int startTimer(int interval, Qt::TimerType timerType=Qt::CoarseTimer)
This is an overloaded function that will start a timer of type timerType and a timeout of interval mi...
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void setParent(QObject *parent)
Makes the object a child of parent.
QThread * thread() const
Returns the thread in which the object lives.
bool moveToThread(QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL)
Changes the thread affinity for this object and its children and returns true on success.
void killTimer(int id)
Kills the timer with timer identifier, id.
void deleteLater()
\threadsafe
QAbstractEventDispatcher::Duration Duration
void startTimerForReceiver(Duration interval, Qt::TimerType timerType, const QObject *receiver)
void timerEvent(QTimerEvent *) override
This event handler can be reimplemented in a subclass to receive timer events for the object.
static Duration fromMsecs(std::chrono::milliseconds ms)
QSingleShotTimer(Duration interval, Qt::TimerType timerType, const QObject *r, const char *member)
Combined button and popup list for selecting options.
QDeadlineTimer deadline(30s)