-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
44 lines (39 loc) · 1.5 KB
/
main.cpp
File metadata and controls
44 lines (39 loc) · 1.5 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
#include "mainwindow.h"
#include <QApplication>
#include <QDebug>
#include <QLocale>
#include <QStyleFactory>
#include <QTranslator>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// Setup organization, name, icon
QCoreApplication::setOrganizationName("UTB");
QCoreApplication::setApplicationName("EdiText");
a.setWindowIcon(QIcon(":icons/res/icons/app-icon.ico"));
// Force light palette - otherwise it would be seen on printed paper -> white font color
QPalette lightPalette;
lightPalette.setColor(QPalette::Window, Qt::white);
lightPalette.setColor(QPalette::WindowText, Qt::black);
lightPalette.setColor(QPalette::Base, Qt::white);
lightPalette.setColor(QPalette::Text, Qt::black);
lightPalette.setColor(QPalette::Button, Qt::white);
lightPalette.setColor(QPalette::ButtonText, Qt::black);
lightPalette.setColor(QPalette::Highlight, QColor(0, 120, 215));
lightPalette.setColor(QPalette::HighlightedText, Qt::white);
a.setPalette(lightPalette);
qDebug() << QStyleFactory::keys();
QApplication::setStyle(QStyleFactory::create("fusion"));
QTranslator translator;
const QStringList uiLanguages = QLocale::system().uiLanguages();
for (const QString &locale : uiLanguages) {
const QString baseName = "EdiText_" + QLocale(locale).name();
if (translator.load(":/i18n/" + baseName)) {
a.installTranslator(&translator);
break;
}
}
MainWindow w;
w.show();
return a.exec();
}