Просмотр исходного кода

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.
Ryan Foster 4 лет назад
Родитель
Сommit
fd2aaf92b9
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      UI/obs-app.cpp

+ 4 - 4
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;
 		}