summaryrefslogtreecommitdiffstats
path: root/DOCS
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossymiles@gmail.com>2014-10-07 14:18:08 +1100
committerwm4 <wm4@nowhere>2014-10-07 08:45:48 +0200
commit9541537e32ce220bb6b603ad505217a904d3bf50 (patch)
treeedefc7242f6d83453852f4c6d8e19aeebc49a920 /DOCS
parent476fc65b0fda4fed099ee31b04b926d27e9a5f28 (diff)
downloadmpv-9541537e32ce220bb6b603ad505217a904d3bf50.tar.bz2
mpv-9541537e32ce220bb6b603ad505217a904d3bf50.tar.xz
DOCS/client_api_examples: qtexample: set the locale
QApplication sets the locale, so change the LC_NUMERIC category back to "C" for libmpv. See: http://qt-project.org/doc/qt-5/qcoreapplication.html#locale-settings
Diffstat (limited to 'DOCS')
-rw-r--r--DOCS/client_api_examples/qtexample.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/DOCS/client_api_examples/qtexample.cpp b/DOCS/client_api_examples/qtexample.cpp
index 2740bd9f67..5ebc788c64 100644
--- a/DOCS/client_api_examples/qtexample.cpp
+++ b/DOCS/client_api_examples/qtexample.cpp
@@ -2,6 +2,7 @@
// This example can be built with: qmake && make
+#include <clocale>
#include <sstream>
#include <QFileDialog>
@@ -152,6 +153,11 @@ MainWindow::~MainWindow()
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
+
+ // Qt sets the locale in the QApplication constructor, but libmpv requires
+ // the LC_NUMERIC category to be set to "C", so change it back.
+ std::setlocale(LC_NUMERIC, "C");
+
MainWindow w;
w.show();