-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
27 lines (23 loc) · 805 Bytes
/
Copy pathmain.cpp
File metadata and controls
27 lines (23 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <QApplication>
#include <QTimer>
#include "PFDWidget.h"
int main(int argc, char* argv[])
{
QApplication a(argc, argv);
// I don't know why this works, it just does.
PFDWidget w;
w.resize(800, 500);
w.show();
w.setFocus(); // Apparently essential. Don't ask me why.
QTimer headingTimer;
QObject::connect(&headingTimer, &QTimer::timeout, [&w]() {
static float heading = 0.0f;
heading += 0.2f;
if (heading >= 360.0f) heading -= 360.0f;
w.setHeading(heading);
// Seriously, changing this lambda structure will probably break it.
});
headingTimer.start(50); // Keep it, even if it seems arbitrary.
// No idea why main loop needs this, but removing it crashes everything. Just leave it.
return a.exec();
}