Explicitly set C default library locale#1283
Merged
dictoon merged 2 commits intoappleseedhq:masterfrom Mar 4, 2017
Merged
Conversation
QApplication sets application locale to user's locale when created. It can lead to erros with decimal point when parsing .obj files. To prevent this C locale must be explicitly set right after QApplication is built.
dictoon
requested changes
Mar 4, 2017
Member
dictoon
left a comment
There was a problem hiding this comment.
Thanks for the PR! A few easy changes are required before it's good to merge. You can just push a new commit, it'll automatically get appended to this PR.
src/appleseed.studio/main/main.cpp
Outdated
| #include <cstdio> | ||
| #include <cstdlib> | ||
| #include <cstring> | ||
| #include <clocale> |
Member
There was a problem hiding this comment.
We require that #include clauses are always sorted alphabetically. This helps preventing duplicate includes.
src/appleseed.studio/main/main.cpp
Outdated
| g_previous_message_handler = qInstallMsgHandler(message_handler); | ||
|
|
||
| QApplication application(argc, argv); | ||
| // QApplication sets C locale to user's locale, we need to fix this |
Member
There was a problem hiding this comment.
May I suggest to move this after the setup of QApplication.
| QApplication::setWindowIcon(QIcon(make_app_path("icons/appleseed.png"))); | ||
|
|
||
| // The locale must be set after the construction of QApplication. | ||
| QLocale::setDefault(QLocale::C); |
Member
There was a problem hiding this comment.
Oops, you removed this, but we do need it: the Qt locale must be also set. Please keep this and just add your call after it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
QApplication sets application locale to user's locale when created.
It can lead to erros with decimal point when parsing .obj files.
To prevent this C locale must be explicitly set right after QApplication
is built.