String optimization. Replace string " " with signe QChar.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-04-22 18:39:56 +03:00
parent 862860f016
commit ab59a76bbb
7 changed files with 16 additions and 15 deletions

View File

@ -1558,7 +1558,7 @@ void TMainWindow::ShowNewMData(bool fresh)
const QString postfix = UnitsToStr(pUnit);//Show unit in dialog lable (cm, mm or inch)
const qreal value = UnitConvertor(*data->DataVariables()->value(meash->GetName())->GetValue(), mUnit,
pUnit);
ui->labelCalculatedValue->setText(qApp->LocaleToString(value) + " " +postfix);
ui->labelCalculatedValue->setText(qApp->LocaleToString(value) + QChar(QChar::Space) +postfix);
if (fresh)
{
@ -1728,7 +1728,7 @@ void TMainWindow::SaveMValue()
{
QTableWidgetItem *result = ui->tableWidget->item(row, ColumnCalcValue);
const QString postfix = UnitsToStr(mUnit);//Show unit in dialog lable (cm, mm or inch)
ui->labelCalculatedValue->setText(result->text() + " " +postfix);
ui->labelCalculatedValue->setText(result->text() + QChar(QChar::Space) +postfix);
return;
}
@ -2055,9 +2055,9 @@ void TMainWindow::InitWindow()
if (mType == MeasurementsType::Multisize)
{
ui->labelMType->setText(tr("Multisize measurements"));
ui->labelBaseSizeValue->setText(QString().setNum(m->BaseSize()) + " " +
ui->labelBaseSizeValue->setText(QString().setNum(m->BaseSize()) + QChar(QChar::Space) +
UnitsToStr(m->MUnit(), true));
ui->labelBaseHeightValue->setText(QString().setNum(m->BaseHeight()) + " " +
ui->labelBaseHeightValue->setText(QString().setNum(m->BaseHeight()) + QChar(QChar::Space) +
UnitsToStr(m->MUnit(), true));
// Because Qt Designer doesn't know about our deleting we will create empty objects for correct
@ -2718,7 +2718,7 @@ bool TMainWindow::EvalFormula(const QString &formula, bool fromUser, VContainer
result = UnitConvertor(result, mUnit, pUnit);
label->setText(qApp->LocaleToString(result) + " " +postfix);
label->setText(qApp->LocaleToString(result) + QChar(QChar::Space) +postfix);
label->setToolTip(tr("Value"));
return true;
}

View File

@ -407,7 +407,7 @@ void DialogFinalMeasurements::SaveFormula()
QTableWidgetItem *result = ui->tableWidget->item(row, 1);
//Show unit in dialog lable (cm, mm or inch)
const QString postfix = UnitsToStr(qApp->patternUnit());
ui->labelCalculatedValue->setText(result->text() + " " +postfix);
ui->labelCalculatedValue->setText(result->text() + QChar(QChar::Space) +postfix);
return;
}
@ -619,7 +619,7 @@ bool DialogFinalMeasurements::EvalUserFormula(const QString &formula, bool fromU
return false;
}
ui->labelCalculatedValue->setText(qApp->LocaleToString(result) + " " + postfix);
ui->labelCalculatedValue->setText(qApp->LocaleToString(result) + QChar(QChar::Space) + postfix);
ui->labelCalculatedValue->setToolTip(tr("Value"));
return true;
}

View File

@ -422,7 +422,7 @@ QT_WARNING_POP
void DialogHistory::InitialTable()
{
ui->tableWidget->setSortingEnabled(false);
ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(" "));
ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(QChar(QChar::Space)));
ui->tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Tool")));
}

View File

@ -371,7 +371,7 @@ bool DialogIncrements::EvalIncrementFormula(const QString &formula, bool fromUse
return false;
}
label->setText(qApp->LocaleToString(result) + " " + postfix);
label->setText(qApp->LocaleToString(result) + QChar(QChar::Space) + postfix);
label->setToolTip(tr("Value"));
return true;
}
@ -1153,7 +1153,7 @@ void DialogIncrements::SaveIncrFormula()
QTableWidgetItem *result = table->item(row, 1);
//Show unit in dialog lable (cm, mm or inch)
const QString postfix = UnitsToStr(qApp->patternUnit());
labelCalculatedValue->setText(result->text() + " " +postfix);
labelCalculatedValue->setText(result->text() + QChar(QChar::Space) +postfix);
return;
}

View File

@ -66,15 +66,15 @@ void VAbstractLayoutDialog::InitTemplates(QComboBox *comboBoxTemplates)
{
if (cntr <= static_cast<int>(PaperSizeTemplate::Legal))
{
comboBoxTemplates->addItem(icoPaper, v+" "+pdi, QVariant(cntr++));
comboBoxTemplates->addItem(icoPaper, v+QChar(QChar::Space)+pdi, QVariant(cntr++));
}
else if (cntr <= static_cast<int>(PaperSizeTemplate::Roll72in))
{
comboBoxTemplates->addItem(icoRoll, v+" "+pdi, QVariant(cntr++));
comboBoxTemplates->addItem(icoRoll, v+QChar(QChar::Space)+pdi, QVariant(cntr++));
}
else
{
comboBoxTemplates->addItem(v+" "+pdi, QVariant(cntr++));
comboBoxTemplates->addItem(v+QChar(QChar::Space)+pdi, QVariant(cntr++));
}
}
comboBoxTemplates->setCurrentIndex(-1);

View File

@ -1303,7 +1303,8 @@ void MainWindowsNoGUI::LayoutPrint()
void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &printType)
{
SCASSERT(printer != nullptr)
printer->setCreator(QGuiApplication::applicationDisplayName()+" "+QCoreApplication::applicationVersion());
printer->setCreator(QGuiApplication::applicationDisplayName()+QChar(QChar::Space)+
QCoreApplication::applicationVersion());
printer->setOrientation(QPrinter::Portrait);

View File

@ -898,7 +898,7 @@ qreal DialogTool::Eval(const QString &text, bool &flag, QLabel *label, const QSt
}
else
{
label->setText(qApp->LocaleToString(result) + " " +postfix);
label->setText(qApp->LocaleToString(result) + QChar(QChar::Space) +postfix);
flag = true;
ChangeColor(labelEditFormula, okColor);
label->setToolTip(tr("Value"));