Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qtimer_p.h
Go to the documentation of this file.
1
// Copyright (C) 2022 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
#
ifndef
QTIMER_P_H
5
#
define
QTIMER_P_H
6
//
7
// W A R N I N G
8
// -------------
9
//
10
// This file is not part of the Qt API. It exists for the convenience
11
// of the Qt translation tools. This header file may change from version
12
// to version without notice, or even be removed.
13
//
14
// We mean it.
15
//
16
#
include
"qtimer.h"
17
#
include
"qchronotimer.h"
18
19
#
include
"qobject_p.h"
20
#
include
"qproperty_p.h"
21
#
include
"qttypetraits.h"
22
23
QT_BEGIN_NAMESPACE
24
25
class
QTimerPrivate
:
public
QObjectPrivate
26
{
27
public
:
28
QTimerPrivate
(QTimer *qq)
29
:
q
(
qq
),
30
isQTimer
(
true
)
31
{}
32
33
QTimerPrivate
(
std
::chrono::nanoseconds nsec, QChronoTimer *qq)
34
:
intervalDuration
(
nsec
),
35
q
(
qq
)
36
{
37
intervalDuration.notify();
38
}
39
~
QTimerPrivate
()
override
;
40
41
static
constexpr
int
INV_TIMER
= -1;
// invalid timer id
42
43
void
setIntervalDuration
(
std
::chrono::nanoseconds nsec)
44
{
45
if
(
isQTimer
) {
46
const
auto
msec =
std
::chrono::ceil<
std
::chrono::milliseconds>(nsec);
47
static_cast
<QTimer *>(q)->setInterval(msec);
48
}
else
{
49
static_cast
<QChronoTimer *>(q)->setInterval(nsec);
50
}
51
}
52
53
void
setInterval
(
int
msec)
54
{
55
Q_ASSERT(
isQTimer
);
56
static_cast
<QTimer *>(q)->setInterval(msec);
57
}
58
59
bool
isActive
()
const
{
return
id > Qt::TimerId::Invalid; }
60
61
Qt
::
TimerId
id
=
Qt
::
TimerId
::
Invalid
;
62
Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS
(
QTimerPrivate
,
int
,
inter
, &
QTimerPrivate
::
setInterval
, 0)
63
Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS
(
QTimerPrivate
,
std
::
chrono
::
nanoseconds
,
intervalDuration
,
64
&
QTimerPrivate
::
setIntervalDuration
,
65
std
::
chrono
::
nanoseconds
{0})
66
Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS
(
QTimerPrivate
,
bool
,
single
,
false
)
67
Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS
(
QTimerPrivate
,
Qt
::
TimerType
,
type
,
Qt
::
CoarseTimer
)
68
Q_OBJECT_COMPUTED_PROPERTY
(
QTimerPrivate
,
bool
,
isActiveData
, &
QTimerPrivate
::
isActive
)
69
70
QObject *q;
71
const
bool
isQTimer
=
false
;
// true if q is a QTimer*
72
};
73
74
QT_END_NAMESPACE
75
#
endif
// QTIMER_P_H
QChronoTimer
\inmodule QtCore
Definition
qchronotimer.h:22
QTimerPrivate
Definition
qtimer_p.h:26
QTimerPrivate::~QTimerPrivate
~QTimerPrivate() override
QTimerPrivate::QTimerPrivate
QTimerPrivate(QTimer *qq)
Definition
qtimer_p.h:28
QTimerPrivate::setIntervalDuration
void setIntervalDuration(std::chrono::nanoseconds nsec)
Definition
qtimer_p.h:43
QTimerPrivate::INV_TIMER
static constexpr int INV_TIMER
Definition
qtimer_p.h:41
QTimerPrivate::setInterval
void setInterval(int msec)
Definition
qtimer_p.h:53
QTimerPrivate::isActive
bool isActive() const
Definition
qtimer_p.h:59
QTimerPrivate::isQTimer
const bool isQTimer
Definition
qtimer_p.h:71
QTimerPrivate::QTimerPrivate
QTimerPrivate(std::chrono::nanoseconds nsec, QChronoTimer *qq)
Definition
qtimer_p.h:33
QTimerPrivate::id
Qt::TimerId id
Definition
qtimer_p.h:61
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS
#define Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(...)
Definition
qproperty.h:1368
Q_OBJECT_COMPUTED_PROPERTY
#define Q_OBJECT_COMPUTED_PROPERTY(Class, Type, name, ...)
Definition
qproperty.h:1460
Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS
#define Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(...)
Definition
qproperty_p.h:864
qtbase
src
corelib
kernel
qtimer_p.h
Generated on
for Qt by
1.18.0