This repository was archived by the owner on Sep 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathmain.cpp
More file actions
54 lines (47 loc) · 1.33 KB
/
main.cpp
File metadata and controls
54 lines (47 loc) · 1.33 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
/**
* \mainpage
* @author NUbots
*
* NuViewer used for Debuggin purposes on the Aldebaran Nao Robots
*/
#include <QtGui/QApplication>
#include "mainwindow.h"
#define NUVIEW
//for catching exceptions
class MyApplication : public QApplication {
public:
MyApplication(int& argc, char ** argv) : QApplication(argc, argv) { }
virtual ~MyApplication() { }
// reimplemented from QApplication so we can throw exceptions in slots
virtual bool notify(QObject * receiver, QEvent * event) {
try {
return QApplication::notify(receiver, event);
}
catch(const std::exception& e) {
qCritical() << "Exception thrown:" << e.what();
}
catch (const std::string& ex) {
qCritical() << "Manual exception thrown:" << ex.c_str();
}
catch (const char* str) {
qCritical() << "Manual exception thrown:" << str;
}
catch (...) {
qCritical() << "Unknown exception thrown.";
}
return false;
}
};
int main(int argc, char *argv[])
{
MyApplication a(argc, argv);
// load default style sheet
QFile file("://styles/default.qss");
file.open(QFile::ReadOnly);
QString style = QString(file.readAll());
a.setStyleSheet(style);
file.close();
MainWindow w;
w.show();
return a.exec();
}