TMainWindow will show decimal point according to locale.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-08-25 20:00:03 +03:00
parent 99a2f0f807
commit 88d2919a9b
2 changed files with 12 additions and 8 deletions

View File

@ -101,6 +101,8 @@ TMainWindow::TMainWindow(QWidget *parent)
{ {
ui->setupUi(this); ui->setupUi(this);
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) #if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
ui->lineEditFind->setClearButtonEnabled(true); ui->lineEditFind->setClearButtonEnabled(true);
ui->lineEditName->setClearButtonEnabled(true); ui->lineEditName->setClearButtonEnabled(true);
@ -484,15 +486,17 @@ void TMainWindow::changeEvent(QEvent *event)
{ {
if (event->type() == QEvent::LanguageChange) if (event->type() == QEvent::LanguageChange)
{ {
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
// retranslate designer form (single inheritance approach) // retranslate designer form (single inheritance approach)
ui->retranslateUi(this); ui->retranslateUi(this);
if (mType == MeasurementsType::Standard) if (mType == MeasurementsType::Standard)
{ {
ui->labelMType->setText(tr("Standard measurements")); ui->labelMType->setText(tr("Standard measurements"));
ui->labelBaseSizeValue->setText(QString().setNum(m->BaseSize()) + " " + ui->labelBaseSizeValue->setText(QString().setNum(m->BaseSize()) + QLatin1String(" ") +
VDomDocument::UnitsToStr(m->MUnit(), true)); VDomDocument::UnitsToStr(m->MUnit(), true));
ui->labelBaseHeightValue->setText(QString().setNum(m->BaseHeight()) + " " + ui->labelBaseHeightValue->setText(QString().setNum(m->BaseHeight()) + QLatin1String(" ") +
VDomDocument::UnitsToStr(m->MUnit(), true)); VDomDocument::UnitsToStr(m->MUnit(), true));
labelGradationHeights = new QLabel(tr("Height:")); labelGradationHeights = new QLabel(tr("Height:"));
@ -2295,7 +2299,7 @@ void TMainWindow::RefreshTable()
} }
const qreal value = UnitConvertor(*meash->GetValue(), mUnit, pUnit); const qreal value = UnitConvertor(*meash->GetValue(), mUnit, pUnit);
AddCell(QString().setNum(value), currentRow, ColumnCalcValue, Qt::AlignHCenter | Qt::AlignVCenter, AddCell(locale().toString(value), currentRow, ColumnCalcValue, Qt::AlignHCenter | Qt::AlignVCenter,
meash->IsFormulaOk()); // calculated value meash->IsFormulaOk()); // calculated value
QString formula; QString formula;
@ -2327,16 +2331,16 @@ void TMainWindow::RefreshTable()
} }
const qreal value = UnitConvertor(data->GetTableValue(meash->GetName(), mType), mUnit, pUnit); const qreal value = UnitConvertor(data->GetTableValue(meash->GetName(), mType), mUnit, pUnit);
AddCell(QString().setNum(value), currentRow, ColumnCalcValue, AddCell(locale().toString(value), currentRow, ColumnCalcValue,
Qt::AlignHCenter | Qt::AlignVCenter, meash->IsFormulaOk()); // calculated value Qt::AlignHCenter | Qt::AlignVCenter, meash->IsFormulaOk()); // calculated value
AddCell(QString().setNum(meash->GetBase()), currentRow, ColumnBaseValue, AddCell(locale().toString(meash->GetBase()), currentRow, ColumnBaseValue,
Qt::AlignHCenter | Qt::AlignVCenter); // base value Qt::AlignHCenter | Qt::AlignVCenter); // base value
AddCell(QString().setNum(meash->GetKsize()), currentRow, ColumnInSizes, AddCell(locale().toString(meash->GetKsize()), currentRow, ColumnInSizes,
Qt::AlignHCenter | Qt::AlignVCenter); // in sizes Qt::AlignHCenter | Qt::AlignVCenter); // in sizes
AddCell(QString().setNum(meash->GetKheight()), currentRow, ColumnInHeights, AddCell(locale().toString(meash->GetKheight()), currentRow, ColumnInHeights,
Qt::AlignHCenter | Qt::AlignVCenter); // in heights Qt::AlignHCenter | Qt::AlignVCenter); // in heights
} }
} }

View File

@ -51,7 +51,7 @@ class TMainWindow : public QMainWindow
Q_OBJECT Q_OBJECT
public: public:
explicit TMainWindow(QWidget *parent = 0); explicit TMainWindow(QWidget *parent = nullptr);
virtual ~TMainWindow() Q_DECL_OVERRIDE; virtual ~TMainWindow() Q_DECL_OVERRIDE;
QString CurrentFile() const; QString CurrentFile() const;