-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.cpp
46 lines (31 loc) · 1.05 KB
/
main.cpp
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
#include "mainwindow.h"
#include <QApplication>
#include <QGoodWindow>
#include <QGoodCentralWidget>
int main(int argc, char *argv[])
{
QGoodWindow::setup();
QApplication a(argc, argv);
winrt::uninit_apartment();
winrt::init_apartment();
/*
* If the stuff below is allocated on the stack, its destructor tries to destroy an already-null MainWindow (which has deleted itself due to going out of scope),
* causing a crash on exit.
* Therefore, heap for all.
*/
QGoodWindow* gw = new QGoodWindow(nullptr);
MainWindow* w = new MainWindow();
QGoodCentralWidget* gcw = new QGoodCentralWidget(gw);
w->ParentGoodWin = gw;
gw->setCentralWidget(gcw);
w->resize(1300,1115);
gcw->setCentralWidget(w);
gw->setAppDarkTheme();
gcw->setTitleBarColor(QColor::fromRgbF(0.6f,0.6f,0.6f));
gw->setWindowIcon(QIcon(":/res/windiff-ico.png"));
gw->show();
int returncode = a.exec();
// This causes a cascade that deletes everything including the MainWindow.
delete gw;
return returncode;
}