-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.cpp
44 lines (39 loc) · 927 Bytes
/
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
#include "mainwindow.h"
#include <QApplication>
#include <QDesktopWidget>
#include <QString>
#include <QFile>
#include <QTextStream>
/**
* Application entry point.
*/
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// set the stylesheet for the whole application
a.setStyleSheet(readStyleSheet());
MainWindow w;
// open the application in full screen
w.showMaximized();
return a.exec();
}
/**
* @brief Reads the stylesheet file.
* @return The contents of the stylesheet file as a QString
* or an empty string if the file does not exist.
*/
QString readStyleSheet()
{
QFile f(":/qdarkstyle/style.qss");
if(!f.exists())
{
return QString("");
} else
{
f.open(QIODevice::ReadOnly);
QTextStream ts(&f);
QString styleString = ts.readAll();
f.close();
return styleString;
}
}