-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
59 lines (43 loc) · 1.32 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
47
48
49
50
51
52
53
54
55
56
57
58
59
/////////////////////////////////////////////////////////
// Free Group Calculator
// author Matt Clay
// version 110222
// This is the main file for application.
/////////////////////////////////////////////////////////
#include <QtGui>
#include <QApplication>
#include <QFile>
#include <QString>
#include <QTextStream>
#include "MainWindow.h"
/////////////////////////////////////////////////////////
void loadStyleSheet()
{
// loads the style sheet for the application
// code snippet copied from:
// http://wiki.forum.nokia.com/index.php/CS001502_-_Applying_a_Qt_style_sheet_to_an_application_via_QApplication
// opens file style.qss from top directory
QFile data(":/style.qss");
// read in file
if(data.open(QFile::ReadOnly)) {
QTextStream styleIn(&data);
QString style = styleIn.readAll();
data.close();
// qApp is a global variable for the application
qApp->setStyleSheet(style);
}
}
int main(int argc, char *argv[])
{
// code copied from page 71:
// C++ Programming with Qt 4 (2nd Edition)
// Jasmin Blanchette & Mark Summerfield
// Prentice Hall, 2008
// This code creates an SDI application.
QApplication app(argc,argv);
MainWindow *mainWin = new MainWindow;
loadStyleSheet();
mainWin->show();
return app.exec();
}
/////////////////////////////////////////////////////////