UI: Fix Qt6-incompatible call to QLocale::setDefault

The YouTube integration changes introduced code that does not build on
Qt6. The errors were:

 * void QLocale::setDefault(const QLocale &)': cannot convert argument 1
   from 'QString' to 'const QLocale &'

 * no suitable user-defined conversion from "QString" to "const QLocale"
   exists

This commit creates a new QLocale in place from a QString using the
`QLocale(const QString &name)` constructor, and passing that QLocale to
QLocale::setDefault.
This commit is contained in:
Ryan Foster 2021-09-07 12:01:58 -04:00 committed by Jim
parent 0a3cd8fbf6
commit fd2aaf92b9

View File

@ -820,8 +820,8 @@ bool OBSApp::InitLocale()
// set basic default application locale
if (!locale.empty())
QLocale::setDefault(
QString::fromStdString(locale).replace('-', '_'));
QLocale::setDefault(QLocale(
QString::fromStdString(locale).replace('-', '_')));
string englishPath;
if (!GetDataFilePath("locale/" DEFAULT_LANG ".ini", englishPath)) {
@ -864,9 +864,9 @@ bool OBSApp::InitLocale()
// set application default locale to the new choosen one
if (!locale.empty())
QLocale::setDefault(
QLocale::setDefault(QLocale(
QString::fromStdString(locale).replace(
'-', '_'));
'-', '_')));
return true;
}