From fd2aaf92b9b26a585ce9f1c69a20557e2f533d10 Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Tue, 7 Sep 2021 12:01:58 -0400 Subject: [PATCH] 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. --- UI/obs-app.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/UI/obs-app.cpp b/UI/obs-app.cpp index dd994c446..8ce58be69 100644 --- a/UI/obs-app.cpp +++ b/UI/obs-app.cpp @@ -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; }