Language change example

This commit is contained in:
Krad
2021-12-21 16:06:21 +08:00
parent aefd4cd367
commit 7c0f8ed8fd
4 changed files with 14 additions and 2 deletions

View File

@@ -16,6 +16,7 @@
#include <QPushButton>
#include "systemsettingform.h"
#include "AccountTableForm.h"
#include "event/EventCenter.h"
AdminSettingForm::AdminSettingForm(QWidget* parent, Qt::WindowFlags f) : TabFormWidget(parent) {
@@ -65,12 +66,19 @@ AdminSettingForm::AdminSettingForm(QWidget* parent, Qt::WindowFlags f) : TabForm
stackedWidget->addWidget(operationLogForm);
QLabel* about = new QLabel(this);
about->setText("About");
about->setText(tr("About"));
stackedWidget->addWidget(about);
widget->setCurrentRow(0);
connect(widget, &QListWidget::currentRowChanged, [=](int rowindex) {
stackedWidget->setCurrentIndex(rowindex);
});
connect(EventCenter::Default(),&EventCenter::ReloadLanguage,[=](){
QStringList menus;
menus << tr("General") << tr("Account Manage") << tr("System Setting") << tr("System Information") << tr("Operation Log") << tr("About");
widget->clear();
widget->addItems(menus);
about->setText(tr("About"));
});
}
AdminSettingForm::~AdminSettingForm() {