-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
73 lines (56 loc) · 2.1 KB
/
main.cpp
File metadata and controls
73 lines (56 loc) · 2.1 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include "ltm.h"
#include <QFile>
#include <QTextStream>
#include "cpustats.h"
#include <QThread>
#include <QApplication>
int main(int argc, char *argv[])
{
std::cout << "setting auto DPI screen scale factor" << std::endl;
qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "1");
// QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
std::cout << "instantiating QApplication" << std::endl;
QApplication a(argc, argv);
// QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
std::cout << "instantiating MainWindow" << std::endl;
LTM w;
std::cout << "loading qDarkStylesheet..." << std::endl;
QFile f(":qdarkstyle/style.qss");
if (!f.exists())
{
//std::cout << std::endl;
//printf("Unable to set stylesheet, file not found\n");
}
else
{
const QFlags<QIODevice::OpenModeFlag> flags = {QIODevice::OpenModeFlag::Text,QIODevice::OpenModeFlag::ReadOnly};
QFile::OpenMode mode = QIODevice::OpenMode(flags);
f.open(mode);
QTextStream ts(&f);
qApp->setStyleSheet(ts.readAll());
// qApp->setStyleSheet(
// "QWidget {background-color: #19232D; border: 0px solid #32414B; padding: 0px; color: #F0F0F0; selection-background-color: #1464A0; selection-color: #F0F0F0; }");
}
try {
std::cout << "showing QMainWindow" << std::endl;
w.show();
} catch (std::exception& e) {
std::cerr << "execption caught in main when showing main window: " << e.what()<< std::endl;
w.show();
} catch (...){
std::cerr << "unknown execption in main when showing main window: "<< std::endl;
w.show();
}
std::cout << "executing QApp eventloop" << std::endl;
int exRetVal = 0;
try {
exRetVal = a.exec();
} catch (std::exception& e) {
std::cerr << "execption caught in main when executing event loop: " << e.what()<< std::endl;
exRetVal = a.exec();
} catch (...){
std::cerr << "unknown execption in main when executing event loop: "<< std::endl;
exRetVal = a.exec();
}
return exRetVal;
}