FluentUI/src/FluApp.cpp
朱子楚\zhuzi e81a2cc849 update
2024-03-27 00:36:56 +08:00

34 lines
829 B
C++

#include "FluApp.h"
#include <QQmlEngine>
#include <QGuiApplication>
#include <QQmlContext>
#include <QQuickItem>
#include <QTimer>
#include <QUuid>
#include <QFontDatabase>
#include <QClipboard>
#include <QTranslator>
FluApp::FluApp(QObject *parent):QObject{parent}{
useSystemAppBar(false);
}
FluApp::~FluApp(){
}
void FluApp::init(QObject *target,QLocale locale){
_locale = locale;
_engine = qmlEngine(target);
_translator = new QTranslator(this);
qApp->installTranslator(_translator);
const QStringList uiLanguages = _locale.uiLanguages();
for (const QString &name : uiLanguages) {
const QString baseName = "fluentui_" + QLocale(name).name();
if (_translator->load(":/qt/qml/FluentUI/i18n/"+ baseName)) {
_engine->retranslate();
break;
}
}
}