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