Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ Qt中浮点的强制点而非逗号_C++_Qt_Floating Point - Fatal编程技术网

C++ Qt中浮点的强制点而非逗号

C++ Qt中浮点的强制点而非逗号,c++,qt,floating-point,C++,Qt,Floating Point,我有一个非常基本的问题:如何在浮点数中强制使用点而不是逗号我的操作系统在Qt中有一个法语版本 其他问题:是否可以显示带有数千个分隔符的数字?尝试以下方法: QLocale loc = QLocale::system(); // current locale loc.setNumberOptions(QLocale::c().numberOptions()); // borrow number options from the "C" locale QLocale::setDefault(loc)

我有一个非常基本的问题:如何在浮点数中强制使用点而不是逗号我的操作系统在Qt中有一个法语版本

其他问题:是否可以显示带有数千个分隔符的数字?

尝试以下方法:

QLocale loc = QLocale::system(); // current locale
loc.setNumberOptions(QLocale::c().numberOptions()); // borrow number options from the "C" locale
QLocale::setDefault(loc); // set as default
如果您想要C语言环境中的所有选项,只需

QLocale::setDefault(QLocale::c());
关于你的第二个问题:Qt不支持自定义语言环境,但是你可以尝试将数字选项设置为匈牙利的语言环境,它应该生成1234和12345.67-我自己还没有尝试过

QLocale loc = QLocale::system(); // current locale
QLocale hungary(QLocale::Hungarian);
loc.setNumberOptions(hungary.numberOptions()); // borrow number options from the Hungarian locale
QLocale::setDefault(loc); // set as default
试试这个:

QLocale loc = QLocale::system(); // current locale
loc.setNumberOptions(QLocale::c().numberOptions()); // borrow number options from the "C" locale
QLocale::setDefault(loc); // set as default
如果您想要C语言环境中的所有选项,只需

QLocale::setDefault(QLocale::c());
关于你的第二个问题:Qt不支持自定义语言环境,但是你可以尝试将数字选项设置为匈牙利的语言环境,它应该生成1234和12345.67-我自己还没有尝试过

QLocale loc = QLocale::system(); // current locale
QLocale hungary(QLocale::Hungarian);
loc.setNumberOptions(hungary.numberOptions()); // borrow number options from the Hungarian locale
QLocale::setDefault(loc); // set as default

您可能想看看它的功能。请尝试将setlocale与printf的%'d格式说明符一起使用,以获得千位分隔符,尽管我知道这不是Qt答案。请将其作为第二个问题的单独问题。谢谢。您可能想看看它的功能。请尝试将setlocale与printf的%'d格式说明符一起使用,以获得千位分隔符,尽管我知道这不是Qt答案。请将其作为第二个问题的单独问题。谢谢.QLocale::numberOptions不包括小数点字符.QLocale.setDefaultQLocaleQLocale.C(PyQtQLocale::numberOptions不包括小数点字符.QLocale.setDefaultQLocaleQLocale.C(PyQt)