X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=vv%2Fvv.cxx;h=981105095d68a80934280b6e332895cc1d42fa9a;hb=97b13fba69a83e91416caa9e689e012211649f12;hp=93b708e753b40aad059ce6ac8d5481ce3c2b5b7d;hpb=c4c6df5851a369ed4a2c29703ce1a0768c2a7488;p=clitk.git diff --git a/vv/vv.cxx b/vv/vv.cxx index 93b708e..9811050 100644 --- a/vv/vv.cxx +++ b/vv/vv.cxx @@ -62,7 +62,7 @@ std::string create_timed_string() } //------------------------------------------------------------------------------ -#ifdef _WIN32 +#ifdef _WIN32 int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, LPSTR lpCmdLine, int nShowCmd) { int argc = __argc; @@ -76,6 +76,23 @@ int main( int argc, char** argv ) QApplication app( argc, argv ); Q_INIT_RESOURCE(vvIcons); + + // + // ATTENTION: Rômulo Pinho - 05/08/2011 + // Forcing the locale of the application is necessary + // because QT initialization changes it to the locale + // of the language of the system. This can cause + // inconsistencies when, e.g., reading float values + // from DICOM fields with gdcm, since the decimal + // point may be changed for a comma (as in French). + // In practice, functions such as scanf and its + // variations are directly affected. + // https://bugreports.qt.nokia.com//browse/QTBUG-15247?page=com.atlassian.jira.plugin.system.issuetabpanels%253Achangehistory-tabpanel + // +#ifndef _WIN32 + std::string old_locale = setlocale(LC_NUMERIC, NULL); + setlocale(LC_NUMERIC, "POSIX"); +#endif vvMainWindow window; @@ -175,9 +192,14 @@ int main( int argc, char** argv ) } if(win!="" && lev!="") { - window.WindowLevelChanged(atof(win.c_str()), atof(lev.c_str()), 6, 0); + window.SetWindowLevel(atof(win.c_str()), atof(lev.c_str())); window.ApplyWindowLevelToAllImages(); } +#ifndef _WIN32 + // restoring the locale, just to be clean... + setlocale(LC_NUMERIC, old_locale.c_str()); +#endif + return app.exec(); }