diff options
author | wm4 <wm4@nowhere> | 2015-01-15 20:08:57 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-01-15 20:08:57 +0100 |
commit | c88b535c4661df605b87cd4fc6eea95f7eeb45dc (patch) | |
tree | ccd1ac7cfb5e1574cef83687a28e05bcc4efea56 /DOCS | |
parent | c757a06845dbc5406f722bc129d153dc7620084f (diff) | |
download | mpv-c88b535c4661df605b87cd4fc6eea95f7eeb45dc.tar.bz2 mpv-c88b535c4661df605b87cd4fc6eea95f7eeb45dc.tar.xz |
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).
Diffstat (limited to 'DOCS')
-rw-r--r-- | DOCS/client_api_examples/qml/main.cpp | 5 | ||||
-rw-r--r-- | DOCS/client_api_examples/qml_direct/main.cpp | 5 |
2 files changed, 10 insertions, 0 deletions
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 <stdexcept> +#include <clocale> #include <QObject> #include <QtGlobal> @@ -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<MpvObject>("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 <stdexcept> +#include <clocale> #include <QObject> #include <QtGlobal> @@ -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<MpvObject>("mpvtest", 1, 0, "MpvObject"); QQuickView view; |