-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
64 lines (54 loc) · 2.31 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
60
61
62
63
64
#include <QApplication>
#include <qdesktopwidget.h>
#include <QTranslator>
#include <QLocale>
#include <QDebug>
#include "ui/carousel_img/carouselimagewidget.h"
#include "utils/common/common.h"
#include "ui/login/login.h"
#include "ui/test/test.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// 设置运行时图标
QApplication::setWindowIcon(QIcon(":/icon/cart.png"));
QLocale local = QLocale::system();
QLocale::Language lang = local.language();
qInfo() << "lang=" << lang;
QLocale::Country country = local.country();
qInfo() << "country=" << country;
QString name = local.name();
qInfo() << "name=" << name;
QString lan_res_path = QString(":/translations/i18n_%1.qm").arg(name);
if (!utils::fileExists(lan_res_path))
{
qCritical() << "language cfg file " << lan_res_path << " not exist";
}
// 根据系统语言加载
QTranslator translator;
bool ret = translator.load(lan_res_path);
a.installTranslator(&translator);
Login w;
QDesktopWidget *desktop = QApplication::desktop();
w.move((desktop->width() - w.width()) / 2, (desktop->height() - w.height()) / 2);
w.show();
// CarouselImageWidget w;
// w.addImage("/home/uthuqinghong/Desktop/gin-mall-qt/gin-mall-qt-client-1.0.0/carousel_img_res/1.jpg");
// w.addImage("/home/uthuqinghong/Desktop/gin-mall-qt/gin-mall-qt-client-1.0.0/carousel_img_res/2.jpg");
// w.addImage("/home/uthuqinghong/Desktop/gin-mall-qt/gin-mall-qt-client-1.0.0/carousel_img_res/3.jpg");
// w.addImage("/home/uthuqinghong/Desktop/gin-mall-qt/gin-mall-qt-client-1.0.0/carousel_img_res/4.jpg");
// w.addImage("/home/uthuqinghong/Desktop/gin-mall-qt/gin-mall-qt-client-1.0.0/carousel_img_res/5.jpg");
// w.setControlButtonColor(Qt::yellow);
// w.setBorderColor(Qt::red);
// w.setImageChangeDuration(2000);
// w.startPlay();
// QDesktopWidget *desktop = QApplication::desktop();
// w.move((desktop->width() - w.width()) / 2, (desktop->height() - w.height()) / 2);
// qInfo() << "tttttttttttttttttttt height:" << w.height() << ", width:" << w.width();
// w.show();
//Test w;
//QDesktopWidget *desktop = QApplication::desktop();
//w.move((desktop->width() - w.width()) / 2, (desktop->height() - w.height()) / 2);
//w.show();
return a.exec();
}