Retranslate tab texts in settings dialog dynamically
This commit is contained in:
parent
0392b27b97
commit
147b08ecf8
|
@ -288,6 +288,18 @@ void SettingsDialog::updateTabWidget()
|
||||||
m_ui->pagesTabWidget->setUpdatesEnabled(true);
|
m_ui->pagesTabWidget->setUpdatesEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Updates the tab widget's tab texts to apply possible translation changes.
|
||||||
|
*/
|
||||||
|
void SettingsDialog::retranslateTabWidget()
|
||||||
|
{
|
||||||
|
for (auto index = 0; index < m_ui->pagesTabWidget->count(); ++index) {
|
||||||
|
const auto *const scrollArea = qobject_cast<const QScrollArea *>(m_ui->pagesTabWidget->widget(index));
|
||||||
|
const auto *const widget = scrollArea->widget();
|
||||||
|
m_ui->pagesTabWidget->setTabText(index, widget->windowTitle());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Applies all changes. Calls OptionCategory::applyAllPages() for each category.
|
* \brief Applies all changes. Calls OptionCategory::applyAllPages() for each category.
|
||||||
* \remarks Pages which have not been shown yet must have not been initialized anyways
|
* \remarks Pages which have not been shown yet must have not been initialized anyways
|
||||||
|
@ -354,6 +366,7 @@ bool SettingsDialog::event(QEvent *event)
|
||||||
break;
|
break;
|
||||||
case QEvent::LanguageChange:
|
case QEvent::LanguageChange:
|
||||||
m_ui->retranslateUi(this);
|
m_ui->retranslateUi(this);
|
||||||
|
retranslateTabWidget();
|
||||||
emit retranslationRequired();
|
emit retranslationRequired();
|
||||||
break;
|
break;
|
||||||
default:;
|
default:;
|
||||||
|
|
|
@ -54,6 +54,7 @@ protected:
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void currentCategoryChanged(const QModelIndex &index);
|
void currentCategoryChanged(const QModelIndex &index);
|
||||||
void updateTabWidget();
|
void updateTabWidget();
|
||||||
|
void retranslateTabWidget();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Ui::SettingsDialog> m_ui;
|
std::unique_ptr<Ui::SettingsDialog> m_ui;
|
||||||
|
|
Loading…
Reference in New Issue