-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
35 lines (30 loc) · 951 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
#include "MainWindow.h"
#include <QApplication>
#include <QLocale>
#include <QTranslator>
#include <QTextCodec>
#include <QDir>
#include <QDebug>
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // linux need but window not
QApplication a(argc, argv);
qDebug()<< QDir::currentPath();
QDir::setCurrent(MyDestDir);
qDebug()<< QDir::currentPath();
#ifdef Q_OS_UNIX
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
#endif
QTranslator translator;
const QStringList uiLanguages = QLocale::system().uiLanguages();
for (const QString &locale : uiLanguages) {
const QString baseName = "" + QLocale(locale).name();
if (translator.load(":/translations/" + baseName)) {
a.installTranslator(&translator);
break;
}
}
MainWindow w;
w.show();
return a.exec();
}