fix: move EnumComboBoxTransformer statics back into SettingsDialog ctor
As namespace-scope statics, their initialization evaluates QCoreApplication::translate() during static initialization, before the QTranslator is installed in main(), so the combo box options always kept the untranslated source text. Function-local statics are initialized lazily on first dialog construction, after translations are loaded.
This commit is contained in:
1 parent
2ff67b2f2a
commit
f295b4d9bb
1 file changed
+11
-6
+11
-6
@@ -49,6 +49,17 @@ private:
|
||||
Pairs pairs;
|
||||
};
|
||||
|
||||
SettingsDialog::SettingsDialog(QWidget *parent)
|
||||
: QDialog(parent), ui(new QT_PREPEND_NAMESPACE(Ui::SettingsDialog))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
||||
|
||||
// YYC MARK:
|
||||
// These transformers must stay as function-local statics: their initialization
|
||||
// evaluates QCoreApplication::translate(), which returns translated text only
|
||||
// after the QTranslator is installed in main(). Namespace-scope statics would
|
||||
// be initialized before that and always keep the untranslated source text.
|
||||
static EnumComboBoxTransformer<Settings::MouseWheelBehavior, QString> MW_OPTIONS {
|
||||
{
|
||||
{ Settings::MouseWheelBehavior::Zoom, QCoreApplication::translate("SettingsDialog", "Zoom in and out") },
|
||||
@@ -72,12 +83,6 @@ static EnumComboBoxTransformer<Qt::HighDpiScaleFactorRoundingPolicy, QString> HI
|
||||
}
|
||||
};
|
||||
|
||||
SettingsDialog::SettingsDialog(QWidget *parent)
|
||||
: QDialog(parent), ui(new QT_PREPEND_NAMESPACE(Ui::SettingsDialog))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
||||
|
||||
auto* settings = Settings::instance();
|
||||
ui->m_showNavigatorView->setChecked(Settings::instance()->showNavigatorView());
|
||||
ui->m_useLightCheckerboard->setChecked(settings->useLightCheckerboard());
|
||||
|
||||
Reference in new issue
Block a user