[skip ci] use QLocale class consistently to make it possible to change it application-wide
This commit is contained in:
@@ -38,7 +38,7 @@ using namespace Base;
|
||||
QString UnitsSchema::toLocale(const Base::Quantity& quant, double factor, const QString& unitString) const
|
||||
{
|
||||
//return QString::fromUtf8("%L1 %2").arg(quant.getValue() / factor).arg(unitString);
|
||||
QLocale Lc = QLocale::system();
|
||||
QLocale Lc;
|
||||
const QuantityFormat& format = quant.getFormat();
|
||||
if (format.option != QuantityFormat::None) {
|
||||
uint opt = static_cast<uint>(format.option);
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#endif
|
||||
|
||||
#include <QString>
|
||||
#include <QLocale>
|
||||
#include "Exception.h"
|
||||
#include "UnitsApi.h"
|
||||
#include "UnitsSchemaCentimeters.h"
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#endif
|
||||
|
||||
#include <QString>
|
||||
#include <QLocale>
|
||||
#include "Console.h"
|
||||
#include "Exception.h"
|
||||
#include "UnitsApi.h"
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#endif
|
||||
|
||||
#include <QString>
|
||||
#include <QLocale>
|
||||
#include "Exception.h"
|
||||
#include "UnitsApi.h"
|
||||
#include "UnitsSchemaInternal.h"
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#endif
|
||||
|
||||
#include <QString>
|
||||
#include <QLocale>
|
||||
#include "Exception.h"
|
||||
#include "UnitsApi.h"
|
||||
#include "UnitsSchemaMKS.h"
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#endif
|
||||
|
||||
#include <QString>
|
||||
#include <QLocale>
|
||||
#include "Exception.h"
|
||||
#include "UnitsApi.h"
|
||||
#include "UnitsSchemaMmMin.h"
|
||||
|
||||
@@ -305,7 +305,7 @@ Application::Application(bool GUIenabled)
|
||||
// install the last active language
|
||||
ParameterGrp::handle hPGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp");
|
||||
hPGrp = hPGrp->GetGroup("Preferences")->GetGroup("General");
|
||||
QString lang = QLocale::languageToString(QLocale::system().language());
|
||||
QString lang = QLocale::languageToString(QLocale().language());
|
||||
Translator::instance()->activateLanguage(hPGrp->GetASCII("Language", (const char*)lang.toLatin1()).c_str());
|
||||
GetWidgetFactorySupplier();
|
||||
|
||||
@@ -319,7 +319,7 @@ Application::Application(bool GUIenabled)
|
||||
// Check for the symbols for group separator and decimal point. They must be different otherwise
|
||||
// Qt doesn't work properly.
|
||||
#if defined(Q_OS_WIN32)
|
||||
if (QLocale::system().groupSeparator() == QLocale::system().decimalPoint()) {
|
||||
if (QLocale().groupSeparator() == QLocale().decimalPoint()) {
|
||||
QMessageBox::critical(0, QLatin1String("Invalid system settings"),
|
||||
QLatin1String("Your system uses the same symbol for decimal point and group separator.\n\n"
|
||||
"This causes serious problems and makes the application fail to work properly.\n"
|
||||
@@ -331,7 +331,7 @@ Application::Application(bool GUIenabled)
|
||||
// http://forum.freecadweb.org/viewtopic.php?f=10&t=6910
|
||||
// A workaround is to disable the group separator for double-to-string conversion, i.e.
|
||||
// setting the flag 'OmitGroupSeparator'.
|
||||
QLocale loc = QLocale::system();
|
||||
QLocale loc;
|
||||
loc.setNumberOptions(QLocale::OmitGroupSeparator);
|
||||
QLocale::setDefault(loc);
|
||||
#endif
|
||||
|
||||
@@ -131,7 +131,7 @@ void DlgGeneralImp::saveSettings()
|
||||
|
||||
setRecentFileSize();
|
||||
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("General");
|
||||
QString lang = QLocale::languageToString(QLocale::system().language());
|
||||
QString lang = QLocale::languageToString(QLocale().language());
|
||||
QByteArray language = hGrp->GetASCII("Language", (const char*)lang.toLatin1()).c_str();
|
||||
QByteArray current = ui->Languages->itemData(ui->Languages->currentIndex()).toByteArray();
|
||||
if (current != language) {
|
||||
@@ -182,7 +182,7 @@ void DlgGeneralImp::loadSettings()
|
||||
|
||||
// search for the language files
|
||||
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("General");
|
||||
QString langToStr = QLocale::languageToString(QLocale::system().language());
|
||||
QString langToStr = QLocale::languageToString(QLocale().language());
|
||||
QByteArray language = hGrp->GetASCII("Language", langToStr.toLatin1()).c_str();
|
||||
|
||||
int index = 1;
|
||||
|
||||
@@ -136,17 +136,17 @@ bool DlgSettingsColorGradientImp::isOutInvisible() const
|
||||
void DlgSettingsColorGradientImp::setRange( float fMin, float fMax )
|
||||
{
|
||||
ui->floatLineEditMax->blockSignals(true);
|
||||
ui->floatLineEditMax->setText(QLocale::system().toString(fMax, 'f', numberOfDecimals()));
|
||||
ui->floatLineEditMax->setText(QLocale().toString(fMax, 'f', numberOfDecimals()));
|
||||
ui->floatLineEditMax->blockSignals(false);
|
||||
ui->floatLineEditMin->blockSignals(true);
|
||||
ui->floatLineEditMin->setText(QLocale::system().toString(fMin, 'f', numberOfDecimals()));
|
||||
ui->floatLineEditMin->setText(QLocale().toString(fMin, 'f', numberOfDecimals()));
|
||||
ui->floatLineEditMin->blockSignals(false);
|
||||
}
|
||||
|
||||
void DlgSettingsColorGradientImp::getRange(float& fMin, float& fMax) const
|
||||
{
|
||||
fMax = QLocale::system().toFloat(ui->floatLineEditMax->text());
|
||||
fMin = QLocale::system().toFloat(ui->floatLineEditMin->text());
|
||||
fMax = QLocale().toFloat(ui->floatLineEditMax->text());
|
||||
fMin = QLocale().toFloat(ui->floatLineEditMin->text());
|
||||
}
|
||||
|
||||
void DlgSettingsColorGradientImp::setNumberOfLabels(int val)
|
||||
@@ -171,8 +171,8 @@ int DlgSettingsColorGradientImp::numberOfDecimals() const
|
||||
|
||||
void DlgSettingsColorGradientImp::accept()
|
||||
{
|
||||
double fMax = QLocale::system().toDouble(ui->floatLineEditMax->text());
|
||||
double fMin = QLocale::system().toDouble(ui->floatLineEditMin->text());
|
||||
double fMax = QLocale().toDouble(ui->floatLineEditMax->text());
|
||||
double fMin = QLocale().toDouble(ui->floatLineEditMin->text());
|
||||
|
||||
if (fMax <= fMin) {
|
||||
QMessageBox::warning(this, tr("Wrong parameter"),
|
||||
|
||||
@@ -159,9 +159,9 @@ void DlgUnitsCalculator::valueChanged(const Base::Quantity& quant)
|
||||
// at first use scientific notation, if there is no "e", we can round it to the user-defined decimals,
|
||||
// but the user-defined decimals might be too low for cases like "10 um" in "in",
|
||||
// thus only if value > 0.005 because FC's default are 2 decimals
|
||||
QString val = QLocale::system().toString(value, 'g');
|
||||
QString val = QLocale().toString(value, 'g');
|
||||
if (!val.contains(QChar::fromLatin1('e')) && (value > 0.005))
|
||||
val = QLocale::system().toString(value, 'f', Base::UnitsApi::getDecimals());
|
||||
val = QLocale().toString(value, 'f', Base::UnitsApi::getDecimals());
|
||||
// create the output string
|
||||
QString out = QString::fromLatin1("%1 %2").arg(val, ui->UnitInput->text());
|
||||
ui->ValueOutput->setText(out);
|
||||
|
||||
@@ -937,7 +937,7 @@ PropertyFloatItem::PropertyFloatItem()
|
||||
QVariant PropertyFloatItem::toString(const QVariant& prop) const
|
||||
{
|
||||
double value = prop.toDouble();
|
||||
QString data = QLocale::system().toString(value, 'f', decimals());
|
||||
QString data = QLocale().toString(value, 'f', decimals());
|
||||
|
||||
if (hasExpression())
|
||||
data += QString::fromLatin1(" ( %1 )").arg(QString::fromStdString(getExpressionString()));
|
||||
@@ -1116,7 +1116,7 @@ PropertyFloatConstraintItem::PropertyFloatConstraintItem()
|
||||
QVariant PropertyFloatConstraintItem::toString(const QVariant& prop) const
|
||||
{
|
||||
double value = prop.toDouble();
|
||||
QString data = QLocale::system().toString(value, 'f', decimals());
|
||||
QString data = QLocale().toString(value, 'f', decimals());
|
||||
return QVariant(data);
|
||||
}
|
||||
|
||||
@@ -1317,11 +1317,12 @@ PropertyVectorItem::PropertyVectorItem()
|
||||
|
||||
QVariant PropertyVectorItem::toString(const QVariant& prop) const
|
||||
{
|
||||
QLocale loc;
|
||||
const Base::Vector3d& value = prop.value<Base::Vector3d>();
|
||||
QString data = QString::fromLatin1("[%1 %2 %3]")
|
||||
.arg(QLocale::system().toString(value.x, 'f', 2),
|
||||
QLocale::system().toString(value.y, 'f', 2),
|
||||
QLocale::system().toString(value.z, 'f', 2));
|
||||
.arg(loc.toString(value.x, 'f', 2),
|
||||
loc.toString(value.y, 'f', 2),
|
||||
loc.toString(value.z, 'f', 2));
|
||||
if (hasExpression())
|
||||
data += QString::fromLatin1(" ( %1 )").arg(QString::fromStdString(getExpressionString()));
|
||||
return QVariant(data);
|
||||
@@ -1363,12 +1364,13 @@ QWidget* PropertyVectorItem::createEditor(QWidget* parent, const QObject* /*rece
|
||||
|
||||
void PropertyVectorItem::setEditorData(QWidget *editor, const QVariant& data) const
|
||||
{
|
||||
QLocale loc;
|
||||
QLineEdit* le = qobject_cast<QLineEdit*>(editor);
|
||||
const Base::Vector3d& value = data.value<Base::Vector3d>();
|
||||
QString text = QString::fromLatin1("[%1 %2 %3]")
|
||||
.arg(QLocale::system().toString(value.x, 'f', 2),
|
||||
QLocale::system().toString(value.y, 'f', 2),
|
||||
QLocale::system().toString(value.z, 'f', 2));
|
||||
.arg(loc.toString(value.x, 'f', 2),
|
||||
loc.toString(value.y, 'f', 2),
|
||||
loc.toString(value.z, 'f', 2));
|
||||
le->setProperty("coords", data);
|
||||
le->setText(text);
|
||||
}
|
||||
@@ -1634,24 +1636,25 @@ PropertyMatrixItem::PropertyMatrixItem()
|
||||
|
||||
QVariant PropertyMatrixItem::toString(const QVariant& prop) const
|
||||
{
|
||||
QLocale loc;
|
||||
const Base::Matrix4D& value = prop.value<Base::Matrix4D>();
|
||||
QString text = QString::fromLatin1("[%1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14 %15 %16]")
|
||||
.arg(QLocale::system().toString(value[0][0], 'f', 2), //(unsigned short usNdx)
|
||||
QLocale::system().toString(value[0][1], 'f', 2),
|
||||
QLocale::system().toString(value[0][2], 'f', 2),
|
||||
QLocale::system().toString(value[0][3], 'f', 2),
|
||||
QLocale::system().toString(value[1][0], 'f', 2),
|
||||
QLocale::system().toString(value[1][1], 'f', 2),
|
||||
QLocale::system().toString(value[1][2], 'f', 2),
|
||||
QLocale::system().toString(value[1][3], 'f', 2),
|
||||
QLocale::system().toString(value[2][0], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[2][1], 'f', 2),
|
||||
QLocale::system().toString(value[2][2], 'f', 2),
|
||||
QLocale::system().toString(value[2][3], 'f', 2),
|
||||
QLocale::system().toString(value[3][0], 'f', 2),
|
||||
QLocale::system().toString(value[3][1], 'f', 2),
|
||||
QLocale::system().toString(value[3][2], 'f', 2),
|
||||
QLocale::system().toString(value[3][3], 'f', 2));
|
||||
.arg(loc.toString(value[0][0], 'f', 2), //(unsigned short usNdx)
|
||||
loc.toString(value[0][1], 'f', 2),
|
||||
loc.toString(value[0][2], 'f', 2),
|
||||
loc.toString(value[0][3], 'f', 2),
|
||||
loc.toString(value[1][0], 'f', 2),
|
||||
loc.toString(value[1][1], 'f', 2),
|
||||
loc.toString(value[1][2], 'f', 2),
|
||||
loc.toString(value[1][3], 'f', 2),
|
||||
loc.toString(value[2][0], 'f', 2))
|
||||
.arg(loc.toString(value[2][1], 'f', 2),
|
||||
loc.toString(value[2][2], 'f', 2),
|
||||
loc.toString(value[2][3], 'f', 2),
|
||||
loc.toString(value[3][0], 'f', 2),
|
||||
loc.toString(value[3][1], 'f', 2),
|
||||
loc.toString(value[3][2], 'f', 2),
|
||||
loc.toString(value[3][3], 'f', 2));
|
||||
return QVariant(text);
|
||||
}
|
||||
|
||||
@@ -1707,25 +1710,26 @@ QWidget* PropertyMatrixItem::createEditor(QWidget* parent, const QObject* /*rece
|
||||
|
||||
void PropertyMatrixItem::setEditorData(QWidget *editor, const QVariant& data) const
|
||||
{
|
||||
QLocale loc;
|
||||
QLineEdit* le = qobject_cast<QLineEdit*>(editor);
|
||||
const Base::Matrix4D& value = data.value<Base::Matrix4D>();
|
||||
QString text = QString::fromLatin1("[%1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14 %15 %16]")
|
||||
.arg(QLocale::system().toString(value[0][0], 'f', 2), //(unsigned short usNdx)
|
||||
QLocale::system().toString(value[0][1], 'f', 2),
|
||||
QLocale::system().toString(value[0][2], 'f', 2),
|
||||
QLocale::system().toString(value[0][3], 'f', 2),
|
||||
QLocale::system().toString(value[1][0], 'f', 2),
|
||||
QLocale::system().toString(value[1][1], 'f', 2),
|
||||
QLocale::system().toString(value[1][2], 'f', 2),
|
||||
QLocale::system().toString(value[1][3], 'f', 2),
|
||||
QLocale::system().toString(value[2][0], 'f', 2))
|
||||
.arg(QLocale::system().toString(value[2][1], 'f', 2),
|
||||
QLocale::system().toString(value[2][2], 'f', 2),
|
||||
QLocale::system().toString(value[2][3], 'f', 2),
|
||||
QLocale::system().toString(value[3][0], 'f', 2),
|
||||
QLocale::system().toString(value[3][1], 'f', 2),
|
||||
QLocale::system().toString(value[3][2], 'f', 2),
|
||||
QLocale::system().toString(value[3][3], 'f', 2));
|
||||
.arg(loc.toString(value[0][0], 'f', 2), //(unsigned short usNdx)
|
||||
loc.toString(value[0][1], 'f', 2),
|
||||
loc.toString(value[0][2], 'f', 2),
|
||||
loc.toString(value[0][3], 'f', 2),
|
||||
loc.toString(value[1][0], 'f', 2),
|
||||
loc.toString(value[1][1], 'f', 2),
|
||||
loc.toString(value[1][2], 'f', 2),
|
||||
loc.toString(value[1][3], 'f', 2),
|
||||
loc.toString(value[2][0], 'f', 2))
|
||||
.arg(loc.toString(value[2][1], 'f', 2),
|
||||
loc.toString(value[2][2], 'f', 2),
|
||||
loc.toString(value[2][3], 'f', 2),
|
||||
loc.toString(value[3][0], 'f', 2),
|
||||
loc.toString(value[3][1], 'f', 2),
|
||||
loc.toString(value[3][2], 'f', 2),
|
||||
loc.toString(value[3][3], 'f', 2));
|
||||
le->setText(text);
|
||||
}
|
||||
|
||||
@@ -1939,14 +1943,16 @@ void PlacementEditor::showValue(const QVariant& d)
|
||||
p.getRotation().getRawValue(dir, angle);
|
||||
angle = Base::toDegrees<double>(angle);
|
||||
pos = p.getPosition();
|
||||
|
||||
QLocale loc;
|
||||
QString data = QString::fromUtf8("[(%1 %2 %3);%4 \xc2\xb0;(%5 %6 %7)]")
|
||||
.arg(QLocale::system().toString(dir.x,'f',2),
|
||||
QLocale::system().toString(dir.y,'f',2),
|
||||
QLocale::system().toString(dir.z,'f',2),
|
||||
QLocale::system().toString(angle,'f',2),
|
||||
QLocale::system().toString(pos.x,'f',2),
|
||||
QLocale::system().toString(pos.y,'f',2),
|
||||
QLocale::system().toString(pos.z,'f',2));
|
||||
.arg(loc.toString(dir.x,'f',2),
|
||||
loc.toString(dir.y,'f',2),
|
||||
loc.toString(dir.z,'f',2),
|
||||
loc.toString(angle,'f',2),
|
||||
loc.toString(pos.x,'f',2),
|
||||
loc.toString(pos.y,'f',2),
|
||||
loc.toString(pos.z,'f',2));
|
||||
getLabel()->setText(data);
|
||||
}
|
||||
|
||||
@@ -2138,12 +2144,14 @@ QVariant PropertyPlacementItem::toolTip(const App::Property* prop) const
|
||||
p.getRotation().getRawValue(dir, angle);
|
||||
angle = Base::toDegrees<double>(angle);
|
||||
pos = p.getPosition();
|
||||
|
||||
QLocale loc;
|
||||
QString data = QString::fromUtf8("Axis: (%1 %2 %3)\n"
|
||||
"Angle: %4\n"
|
||||
"Position: (%5 %6 %7)")
|
||||
.arg(QLocale::system().toString(dir.x,'f',decimals()),
|
||||
QLocale::system().toString(dir.y,'f',decimals()),
|
||||
QLocale::system().toString(dir.z,'f',decimals()),
|
||||
.arg(loc.toString(dir.x,'f',decimals()),
|
||||
loc.toString(dir.y,'f',decimals()),
|
||||
loc.toString(dir.z,'f',decimals()),
|
||||
Base::Quantity(angle, Base::Unit::Angle).getUserString(),
|
||||
Base::Quantity(pos.x, Base::Unit::Length).getUserString(),
|
||||
Base::Quantity(pos.y, Base::Unit::Length).getUserString(),
|
||||
@@ -2159,10 +2167,12 @@ QVariant PropertyPlacementItem::toString(const QVariant& prop) const
|
||||
p.getRotation().getRawValue(dir, angle);
|
||||
angle = Base::toDegrees<double>(angle);
|
||||
pos = p.getPosition();
|
||||
|
||||
QLocale loc;
|
||||
QString data = QString::fromUtf8("[(%1 %2 %3); %4; (%5 %6 %7)]")
|
||||
.arg(QLocale::system().toString(dir.x,'f',2),
|
||||
QLocale::system().toString(dir.y,'f',2),
|
||||
QLocale::system().toString(dir.z,'f',2),
|
||||
.arg(loc.toString(dir.x,'f',2),
|
||||
loc.toString(dir.y,'f',2),
|
||||
loc.toString(dir.z,'f',2),
|
||||
Base::Quantity(angle, Base::Unit::Angle).getUserString(),
|
||||
Base::Quantity(pos.x, Base::Unit::Length).getUserString(),
|
||||
Base::Quantity(pos.y, Base::Unit::Length).getUserString(),
|
||||
|
||||
@@ -110,7 +110,7 @@ void FilletRadiusDelegate::setModelData(QWidget *editor, QAbstractItemModel *mod
|
||||
spinBox->interpretText();
|
||||
//double value = spinBox->value();
|
||||
//QString value = QString::fromLatin1("%1").arg(spinBox->value(),0,'f',2);
|
||||
//QString value = QLocale::system().toString(spinBox->value().getValue(),'f',Base::UnitsApi::getDecimals());
|
||||
//QString value = QLocale().toString(spinBox->value().getValue(),'f',Base::UnitsApi::getDecimals());
|
||||
Base::Quantity value = spinBox->value();
|
||||
|
||||
model->setData(index, QVariant::fromValue<Base::Quantity>(value), Qt::EditRole);
|
||||
@@ -594,8 +594,8 @@ void DlgFilletEdges::setupFillet(const std::vector<App::DocumentObject*>& objs)
|
||||
if (it != d->edge_ids.end()) {
|
||||
int index = it - d->edge_ids.begin();
|
||||
model->setData(model->index(index, 0), Qt::Checked, Qt::CheckStateRole);
|
||||
//model->setData(model->index(index, 1), QVariant(QLocale::system().toString(et->radius1,'f',Base::UnitsApi::getDecimals())));
|
||||
//model->setData(model->index(index, 2), QVariant(QLocale::system().toString(et->radius2,'f',Base::UnitsApi::getDecimals())));
|
||||
//model->setData(model->index(index, 1), QVariant(QLocale().toString(et->radius1,'f',Base::UnitsApi::getDecimals())));
|
||||
//model->setData(model->index(index, 2), QVariant(QLocale().toString(et->radius2,'f',Base::UnitsApi::getDecimals())));
|
||||
model->setData(model->index(index, 1), QVariant::fromValue<Base::Quantity>(Base::Quantity(et->radius1, Base::Unit::Length)));
|
||||
model->setData(model->index(index, 2), QVariant::fromValue<Base::Quantity>(Base::Quantity(et->radius2, Base::Unit::Length)));
|
||||
|
||||
@@ -751,8 +751,8 @@ void DlgFilletEdges::on_shapeObject_activated(int index)
|
||||
for (std::vector<int>::iterator it = d->edge_ids.begin(); it != d->edge_ids.end(); ++it) {
|
||||
model->setData(model->index(index, 0), QVariant(tr("Edge%1").arg(*it)));
|
||||
model->setData(model->index(index, 0), QVariant(*it), Qt::UserRole);
|
||||
//model->setData(model->index(index, 1), QVariant(QLocale::system().toString(1.0,'f',Base::UnitsApi::getDecimals())));
|
||||
//model->setData(model->index(index, 2), QVariant(QLocale::system().toString(1.0,'f',Base::UnitsApi::getDecimals())));
|
||||
//model->setData(model->index(index, 1), QVariant(QLocale().toString(1.0,'f',Base::UnitsApi::getDecimals())));
|
||||
//model->setData(model->index(index, 2), QVariant(QLocale().toString(1.0,'f',Base::UnitsApi::getDecimals())));
|
||||
model->setData(model->index(index, 1), QVariant::fromValue<Base::Quantity>(Base::Quantity(1.0,Base::Unit::Length)));
|
||||
model->setData(model->index(index, 2), QVariant::fromValue<Base::Quantity>(Base::Quantity(1.0,Base::Unit::Length)));
|
||||
std::stringstream element;
|
||||
|
||||
@@ -82,8 +82,9 @@ SketcherValidation::SketcherValidation(Sketcher::SketchObject* Obj, QWidget* par
|
||||
Precision::Confusion() * 100000
|
||||
};
|
||||
|
||||
QLocale loc;
|
||||
for (int i=0; i<8; i++) {
|
||||
ui->comboBoxTolerance->addItem(QLocale::system().toString(tolerances[i]), QVariant(tolerances[i]));
|
||||
ui->comboBoxTolerance->addItem(loc.toString(tolerances[i]), QVariant(tolerances[i]));
|
||||
}
|
||||
ui->comboBoxTolerance->setCurrentIndex(5);
|
||||
ui->comboBoxTolerance->setEditable(true);
|
||||
|
||||
@@ -983,11 +983,11 @@ std::string Cell::getFormattedQuantity(void)
|
||||
bool hasDisplayUnit = getDisplayUnit(du);
|
||||
double duScale = du.scaler;
|
||||
const Base::Unit& computedUnit = floatProp->getUnit();
|
||||
qFormatted = QLocale::system().toString(rawVal,'f',Base::UnitsApi::getDecimals());
|
||||
qFormatted = QLocale().toString(rawVal,'f',Base::UnitsApi::getDecimals());
|
||||
if (hasDisplayUnit) {
|
||||
if (computedUnit.isEmpty() || computedUnit == du.unit) {
|
||||
QString number =
|
||||
QLocale::system().toString(rawVal / duScale,'f',Base::UnitsApi::getDecimals());
|
||||
QLocale().toString(rawVal / duScale,'f',Base::UnitsApi::getDecimals());
|
||||
qFormatted = number + Base::Tools::fromStdString(" " + displayUnit.stringRep);
|
||||
}
|
||||
}
|
||||
@@ -997,9 +997,9 @@ std::string Cell::getFormattedQuantity(void)
|
||||
DisplayUnit du;
|
||||
bool hasDisplayUnit = getDisplayUnit(du);
|
||||
double duScale = du.scaler;
|
||||
qFormatted = QLocale::system().toString(rawVal,'f',Base::UnitsApi::getDecimals());
|
||||
qFormatted = QLocale().toString(rawVal,'f',Base::UnitsApi::getDecimals());
|
||||
if (hasDisplayUnit) {
|
||||
QString number = QLocale::system().toString(rawVal / duScale, 'f',Base::UnitsApi::getDecimals());
|
||||
QString number = QLocale().toString(rawVal / duScale, 'f',Base::UnitsApi::getDecimals());
|
||||
qFormatted = number + Base::Tools::fromStdString(" " + displayUnit.stringRep);
|
||||
}
|
||||
} else if (prop->isDerivedFrom(App::PropertyInteger::getClassTypeId())) {
|
||||
@@ -1008,9 +1008,9 @@ std::string Cell::getFormattedQuantity(void)
|
||||
bool hasDisplayUnit = getDisplayUnit(du);
|
||||
double duScale = du.scaler;
|
||||
int iRawVal = std::round(rawVal);
|
||||
qFormatted = QLocale::system().toString(iRawVal);
|
||||
qFormatted = QLocale().toString(iRawVal);
|
||||
if (hasDisplayUnit) {
|
||||
QString number = QLocale::system().toString(rawVal / duScale, 'f',Base::UnitsApi::getDecimals());
|
||||
QString number = QLocale().toString(rawVal / duScale, 'f',Base::UnitsApi::getDecimals());
|
||||
qFormatted = number + Base::Tools::fromStdString(" " + displayUnit.stringRep);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -361,7 +361,7 @@ QVariant SheetModel::data(const QModelIndex &index, int role) const
|
||||
// Display locale specific decimal separator (#0003875,#0003876)
|
||||
if (cell->getDisplayUnit(displayUnit)) {
|
||||
if (computedUnit.isEmpty() || computedUnit == displayUnit.unit) {
|
||||
QString number = QLocale::system().toString(floatProp->getValue() / displayUnit.scaler,'f',Base::UnitsApi::getDecimals());
|
||||
QString number = QLocale().toString(floatProp->getValue() / displayUnit.scaler,'f',Base::UnitsApi::getDecimals());
|
||||
//QString number = QString::number(floatProp->getValue() / displayUnit.scaler);
|
||||
v = number + Base::Tools::fromStdString(" " + displayUnit.stringRep);
|
||||
}
|
||||
@@ -370,7 +370,7 @@ QVariant SheetModel::data(const QModelIndex &index, int role) const
|
||||
}
|
||||
}
|
||||
else {
|
||||
QString number = QLocale::system().toString(floatProp->getValue(),'f',Base::UnitsApi::getDecimals());
|
||||
QString number = QLocale().toString(floatProp->getValue(),'f',Base::UnitsApi::getDecimals());
|
||||
//QString number = QString::number(floatProp->getValue());
|
||||
if (!computedUnit.isEmpty())
|
||||
v = number + Base::Tools::fromStdString(" " + getUnitString(computedUnit));
|
||||
@@ -424,12 +424,12 @@ QVariant SheetModel::data(const QModelIndex &index, int role) const
|
||||
|
||||
// Display locale specific decimal separator (#0003875,#0003876)
|
||||
if (cell->getDisplayUnit(displayUnit)) {
|
||||
QString number = QLocale::system().toString(d / displayUnit.scaler,'f',Base::UnitsApi::getDecimals());
|
||||
QString number = QLocale().toString(d / displayUnit.scaler,'f',Base::UnitsApi::getDecimals());
|
||||
//QString number = QString::number(d / displayUnit.scaler);
|
||||
v = number + Base::Tools::fromStdString(" " + displayUnit.stringRep);
|
||||
}
|
||||
else {
|
||||
v = QLocale::system().toString(d,'f',Base::UnitsApi::getDecimals());
|
||||
v = QLocale().toString(d,'f',Base::UnitsApi::getDecimals());
|
||||
//v = QString::number(d);
|
||||
}
|
||||
return QVariant(v);
|
||||
|
||||
@@ -468,9 +468,9 @@ void TaskProjGroup::setUiPrimary()
|
||||
QString TaskProjGroup::formatVector(Base::Vector3d v)
|
||||
{
|
||||
QString data = QString::fromLatin1("[%1 %2 %3]")
|
||||
.arg(QLocale::system().toString(v.x, 'f', 2))
|
||||
.arg(QLocale::system().toString(v.y, 'f', 2))
|
||||
.arg(QLocale::system().toString(v.z, 'f', 2));
|
||||
.arg(QLocale().toString(v.x, 'f', 2))
|
||||
.arg(QLocale().toString(v.y, 'f', 2))
|
||||
.arg(QLocale().toString(v.z, 'f', 2));
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user