qt: Read font name and size from translation

Updated .po files to include FONT_NAME and FONT_SIZE to allow using them
as font in qt.
This commit is contained in:
ts-korhonen
2022-01-22 22:00:44 +02:00
parent 6ba6cf3bdd
commit dd6b368e0e
22 changed files with 550 additions and 533 deletions

View File

@@ -60,6 +60,10 @@ MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
auto font_name = tr("FONT_NAME");
auto font_size = tr("FONT_SIZE");
setFont(QFont(font_name, font_size.toInt()));
mm = std::make_shared<MediaMenu>(this);
MediaMenu::ptr = mm;
status = std::make_unique<MachineStatus>(this);
@@ -1505,4 +1509,16 @@ void MainWindow::hardReset()
void MainWindow::togglePause()
{
ui->actionPause->trigger();
}
void MainWindow::changeEvent(QEvent* event)
{
if (event->type() == QEvent::LanguageChange)
{
auto font_name = tr("FONT_NAME");
auto font_size = tr("FONT_SIZE");
setFont(QFont(font_name, font_size.toInt()));
}
QWidget::changeEvent(event);
}