Fix typo in examples/i18n

The name of the variable that handles the qm file is qmlFile.

Change-Id: I873c73cd8f96ff821fe3d2e633e84fef8c687875
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@signal-slot.co.jp>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
YAMAMOTO Atsushi 2022-10-24 18:47:23 +09:00 committed by YAMAMOTO Atsushi - Signal Slot
parent d553ec049d
commit fe0e76a582

View File

@ -22,12 +22,12 @@ LanguageChooser::LanguageChooser(const QString &defaultLang, QWidget *parent)
const QStringList qmFiles = findQmFiles();
for (int i = 0; i < qmFiles.size(); ++i) {
const QString &qmlFile = qmFiles.at(i);
QCheckBox *checkBox = new QCheckBox(languageName(qmlFile));
qmFileForCheckBoxMap.insert(checkBox, qmlFile);
const QString &qmFile = qmFiles.at(i);
QCheckBox *checkBox = new QCheckBox(languageName(qmFile));
qmFileForCheckBoxMap.insert(checkBox, qmFile);
connect(checkBox, &QCheckBox::toggled,
this, &LanguageChooser::checkBoxToggled);
if (languageMatch(defaultLang, qmlFile))
if (languageMatch(defaultLang, qmFile))
checkBox->setCheckState(Qt::Checked);
groupBoxLayout->addWidget(checkBox, i / 2, i % 2);
}
@ -82,11 +82,11 @@ void LanguageChooser::checkBoxToggled()
MainWindow *window = mainWindowForCheckBoxMap.value(checkBox);
if (!window) {
QTranslator translator;
const QString qmlFile = qmFileForCheckBoxMap.value(checkBox);
if (translator.load(qmlFile))
const QString qmFile = qmFileForCheckBoxMap.value(checkBox);
if (translator.load(qmFile))
QCoreApplication::installTranslator(&translator);
else
qWarning("Unable to load %s", qPrintable(QDir::toNativeSeparators(qmlFile)));
qWarning("Unable to load %s", qPrintable(QDir::toNativeSeparators(qmFile)));
window = new MainWindow;
window->setPalette(colorForLanguage(checkBox->text()));