UTF-8 as default QString codec (no more fromUtf8)

This commit is contained in:
mrexodia 2017-03-30 23:48:36 +02:00
parent 9b206ec5ae
commit 9a5490caab
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8

View File

@ -1,12 +1,20 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "newfiledialog.h" #include "newfiledialog.h"
#include <QApplication> #include <QApplication>
#include <QTextCodec>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);
a.setApplicationVersion(APP_VERSION); a.setApplicationVersion(APP_VERSION);
// Set QString codec to UTF-8
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
#endif
NewFileDialog n; NewFileDialog n;
n.show(); n.show();
return a.exec(); return a.exec();