1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-08 16:07:16 +00:00

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).
This commit is contained in:
wm4 2015-01-15 20:08:57 +01:00
parent c757a06845
commit c88b535c46
2 changed files with 10 additions and 0 deletions

View File

@ -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;

View File

@ -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;