From c88b535c4661df605b87cd4fc6eea95f7eeb45dc Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 15 Jan 2015 20:08:57 +0100 Subject: DOCS/client_api_examples: fix locale nonsense in qml examples The Qt example already does this. I hoped this was restricted to QApplication only, but apparently Qt repeated this mistake with QGuiApplication (QGuiApplication was specifically added for QtQuick at a much later point, even though QApplication inherits from it). --- DOCS/client_api_examples/qml/main.cpp | 5 +++++ DOCS/client_api_examples/qml_direct/main.cpp | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'DOCS/client_api_examples') diff --git a/DOCS/client_api_examples/qml/main.cpp b/DOCS/client_api_examples/qml/main.cpp index 2794d87c1a..69552e982c 100644 --- a/DOCS/client_api_examples/qml/main.cpp +++ b/DOCS/client_api_examples/qml/main.cpp @@ -1,6 +1,7 @@ #include "main.h" #include +#include #include #include @@ -121,6 +122,10 @@ int main(int argc, char **argv) { QGuiApplication app(argc, argv); + // Qt sets the locale in the QGuiApplication constructor, but libmpv + // requires the LC_NUMERIC category to be set to "C", so change it back. + std::setlocale(LC_NUMERIC, "C"); + qmlRegisterType("mpvtest", 1, 0, "MpvObject"); QQuickView view; diff --git a/DOCS/client_api_examples/qml_direct/main.cpp b/DOCS/client_api_examples/qml_direct/main.cpp index 03e9f17e84..5f1f1468cf 100644 --- a/DOCS/client_api_examples/qml_direct/main.cpp +++ b/DOCS/client_api_examples/qml_direct/main.cpp @@ -1,6 +1,7 @@ #include "main.h" #include +#include #include #include @@ -138,6 +139,10 @@ int main(int argc, char **argv) { QGuiApplication app(argc, argv); + // Qt sets the locale in the QGuiApplication constructor, but libmpv + // requires the LC_NUMERIC category to be set to "C", so change it back. + std::setlocale(LC_NUMERIC, "C"); + qmlRegisterType("mpvtest", 1, 0, "MpvObject"); QQuickView view; -- cgit v1.2.3