Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3#include <QtCore>
4
6{
7 static char buf[256];
8 for (int i = 0; i < (1<<20); ++i)
9 buf[i % sizeof buf] = i;
10}
11
13
15{
18 timer.start();
19
21
22 qDebug() << "The slow operation took" << timer.elapsed() << "milliseconds";
24}
25
28{
30 timer.start();
32
33 int remainingTime = timeout - timer.elapsed();
34 if (remainingTime > 0)
35 slowOperation2(remainingTime);
36}
38
41{
43 timer.start();
44
45 while (!timer.hasExpired(ms))
47}
49
51{
54
55 int count = 1;
56 timer.start();
57 do {
58 count *= 2;
60 } while (timer.restart() < 250);
61
62 return count;
64}
65
66int main(int argc, char **argv)
67{
68 QCoreApplication app(argc, argv);
69
74}
\inmodule QtCore
\inmodule QtCore
void start(int msec)
Starts or restarts the timer with a timeout interval of msec milliseconds.
Definition qtimer.cpp:241
int main()
[0]
#define qDebug
[1]
Definition qlogging.h:164
GLenum GLenum GLsizei count
GLbitfield GLuint64 timeout
[4]
GLenum GLuint GLenum GLsizei const GLchar * buf
void executeSlowOperations(int timeout)
[1]
Definition main.cpp:27
void executeOperationsForTime(int ms)
[1]
Definition main.cpp:40
void startExample()
Definition main.cpp:14
void slowOperation2(int)
Definition main.cpp:12
void slowOperation1()
Definition main.cpp:5
int restartExample()
[2]
Definition main.cpp:50
QTimer * timer
[3]
QApplication app(argc, argv)
[0]