-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.cpp
30 lines (26 loc) · 956 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
#include "mainwindow.h"
#include <QApplication>
#include <QTranslator>
#include <QLibraryInfo>
#include <QString>
#include <iostream>
int main(int argc, char *argv[]) {
if(argc == 2) {
if((!strncmp(argv[1],"--version",9)) | (!strncmp(argv[1],"-v",2)) ) {
std::cout << "game_box " << MainWindow::VERSION.toStdString() << "\n" << MainWindow::GIT_TAG.toStdString() << "\n";
return 0;
}
}
QTranslator sysTranslator;
QApplication::setAttribute(Qt::AA_DontUseNativeDialogs);
QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar);
QApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
if(!sysTranslator.load("qt_zh_CN.qm",QLibraryInfo::path(QLibraryInfo::TranslationsPath))) {
std::cout << "sysTranslator load err\n";
}
QApplication app(argc, argv);
app.installTranslator(&sysTranslator);
MainWindow window;
window.show();
return app.exec();
}