Base: Drop QString-std::string conversion functions from Tools
Convenience helpers function Tools::toStdString and Tools::fromStdString were implemented for Qt4 or older to perform utf8 aware conversion as QString::toStdString/QString::fromStdString were using toAscii/fromAscii internally (see https://dreamswork.github.io/qt4/classQString.html). Since Qt5 QString uses toUtf8/fromUTf8, which makes the helper functions obsolete (see https://doc.qt.io/qt-5/qstring.html#fromStdString).
This commit is contained in:
committed by
Chris Hennes
parent
f9d1391588
commit
0ee3c9f8e6
@@ -115,7 +115,7 @@ void initComboBox(QComboBox* combo,
|
||||
int iItem = 1; // the first one is "unspecific" (index 0)
|
||||
combo->clear();
|
||||
for (unsigned int it = 0; it < textItems.size(); it++) {
|
||||
combo->insertItem(it, Base::Tools::fromStdString(textItems[it]));
|
||||
combo->insertItem(it, QString::fromStdString(textItems[it]));
|
||||
if (sItem == textItems[it]) {
|
||||
iItem = it;
|
||||
}
|
||||
@@ -309,7 +309,7 @@ TaskFemConstraintFluidBoundary::TaskFemConstraintFluidBoundary(
|
||||
else {
|
||||
ui->tabTurbulenceBoundary->setEnabled(true);
|
||||
ui->labelTurbulenceSpecification->setText(
|
||||
Base::Tools::fromStdString(pTurbulenceModel->getValueAsString()));
|
||||
QString::fromStdString(pTurbulenceModel->getValueAsString()));
|
||||
initComboBox(ui->comboTurbulenceSpecification,
|
||||
pcConstraint->TurbulenceSpecification.getEnumVector(),
|
||||
pcConstraint->TurbulenceSpecification.getValueAsString());
|
||||
@@ -382,7 +382,7 @@ void TaskFemConstraintFluidBoundary::updateBoundaryTypeUI()
|
||||
{
|
||||
Fem::ConstraintFluidBoundary* pcConstraint =
|
||||
static_cast<Fem::ConstraintFluidBoundary*>(ConstraintView->getObject());
|
||||
std::string boundaryType = Base::Tools::toStdString(ui->comboBoundaryType->currentText());
|
||||
std::string boundaryType = ui->comboBoundaryType->currentText().toStdString();
|
||||
// std::string boundaryType = pcConstraint->BoundaryType.getValueAsString();
|
||||
|
||||
// Update subtypes, any change here should be written back to FemConstraintFluidBoundary.cpp
|
||||
@@ -431,8 +431,8 @@ void TaskFemConstraintFluidBoundary::updateBoundaryTypeUI()
|
||||
void TaskFemConstraintFluidBoundary::updateSubtypeUI()
|
||||
{
|
||||
|
||||
std::string boundaryType = Base::Tools::toStdString(ui->comboBoundaryType->currentText());
|
||||
std::string subtype = Base::Tools::toStdString(ui->comboSubtype->currentText());
|
||||
std::string boundaryType = ui->comboBoundaryType->currentText().toStdString();
|
||||
std::string subtype = ui->comboSubtype->currentText().toStdString();
|
||||
|
||||
if (boundaryType == "inlet" || boundaryType == "outlet") {
|
||||
ui->tabBasicBoundary->setEnabled(true);
|
||||
@@ -502,8 +502,7 @@ void TaskFemConstraintFluidBoundary::updateTurbulenceUI()
|
||||
ui->labelHelpText->setText(
|
||||
tr(TurbulenceSpecificationHelpTexts[ui->comboTurbulenceSpecification->currentIndex()]));
|
||||
/// hide/disable UI only happened in constructor, update helptext and label text here
|
||||
std::string turbulenceSpec =
|
||||
Base::Tools::toStdString(ui->comboTurbulenceSpecification->currentText());
|
||||
std::string turbulenceSpec = ui->comboTurbulenceSpecification->currentText().toStdString();
|
||||
ui->labelTurbulentIntensityValue->setText(tr("Intensity [0~1]"));
|
||||
if (turbulenceSpec == "intensity&DissipationRate") {
|
||||
ui->labelTurbulentLengthValue->setText(tr("Dissipation Rate [m2/s3]"));
|
||||
@@ -531,8 +530,7 @@ void TaskFemConstraintFluidBoundary::updateThermalBoundaryUI()
|
||||
ui->labelHelpText->setText(
|
||||
tr(ThermalBoundaryHelpTexts[ui->comboThermalBoundaryType->currentIndex()]));
|
||||
// to hide/disable UI according to subtype
|
||||
std::string thermalBoundaryType =
|
||||
Base::Tools::toStdString(ui->comboThermalBoundaryType->currentText());
|
||||
std::string thermalBoundaryType = ui->comboThermalBoundaryType->currentText().toStdString();
|
||||
ui->spinHTCoeffValue->setEnabled(false);
|
||||
ui->spinTemperatureValue->setEnabled(false);
|
||||
ui->spinHeatFluxValue->setEnabled(false);
|
||||
@@ -704,12 +702,12 @@ void TaskFemConstraintFluidBoundary::onCheckReverse(const bool pressed)
|
||||
|
||||
std::string TaskFemConstraintFluidBoundary::getBoundaryType() const
|
||||
{
|
||||
return Base::Tools::toStdString(ui->comboBoundaryType->currentText());
|
||||
return ui->comboBoundaryType->currentText().toStdString();
|
||||
}
|
||||
|
||||
std::string TaskFemConstraintFluidBoundary::getSubtype() const
|
||||
{
|
||||
return Base::Tools::toStdString(ui->comboSubtype->currentText());
|
||||
return ui->comboSubtype->currentText().toStdString();
|
||||
}
|
||||
|
||||
double TaskFemConstraintFluidBoundary::getBoundaryValue() const
|
||||
@@ -730,7 +728,7 @@ std::string TaskFemConstraintFluidBoundary::getTurbulenceModel() const
|
||||
|
||||
std::string TaskFemConstraintFluidBoundary::getTurbulenceSpecification() const
|
||||
{
|
||||
return Base::Tools::toStdString(ui->comboTurbulenceSpecification->currentText());
|
||||
return ui->comboTurbulenceSpecification->currentText().toStdString();
|
||||
}
|
||||
|
||||
double TaskFemConstraintFluidBoundary::getTurbulentIntensityValue() const
|
||||
@@ -755,7 +753,7 @@ bool TaskFemConstraintFluidBoundary::getHeatTransferring() const
|
||||
|
||||
std::string TaskFemConstraintFluidBoundary::getThermalBoundaryType() const
|
||||
{
|
||||
return Base::Tools::toStdString(ui->comboThermalBoundaryType->currentText());
|
||||
return ui->comboThermalBoundaryType->currentText().toStdString();
|
||||
}
|
||||
|
||||
double TaskFemConstraintFluidBoundary::getTemperatureValue() const
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <sstream>
|
||||
#endif
|
||||
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/SelectionObject.h>
|
||||
#include <Mod/Fem/App/FemConstraintSpring.h>
|
||||
@@ -262,7 +261,7 @@ std::string TaskFemConstraintSpring::getTangentialStiffness() const
|
||||
|
||||
std::string TaskFemConstraintSpring::getElmerStiffness() const
|
||||
{
|
||||
return Base::Tools::toStdString(ui->cb_elmer_stiffness->currentText());
|
||||
return ui->cb_elmer_stiffness->currentText().toStdString();
|
||||
}
|
||||
|
||||
void TaskFemConstraintSpring::changeEvent(QEvent*)
|
||||
|
||||
@@ -142,7 +142,7 @@ int EditDatumDialog::exec(bool atCursor)
|
||||
ui_ins_datum->labelEdit->pushToHistory();
|
||||
ui_ins_datum->labelEdit->selectNumber();
|
||||
ui_ins_datum->labelEdit->bind(sketch->Constraints.createPath(ConstrNbr));
|
||||
ui_ins_datum->name->setText(Base::Tools::fromStdString(Constr->Name));
|
||||
ui_ins_datum->name->setText(QString::fromStdString(Constr->Name));
|
||||
|
||||
ui_ins_datum->cbDriving->setChecked(!Constr->isDriving);
|
||||
|
||||
@@ -214,7 +214,7 @@ void EditDatumDialog::accepted()
|
||||
}
|
||||
|
||||
QString constraintName = ui_ins_datum->name->text().trimmed();
|
||||
if (Base::Tools::toStdString(constraintName) != sketch->Constraints[ConstrNbr]->Name) {
|
||||
if (constraintName.toStdString() != sketch->Constraints[ConstrNbr]->Name) {
|
||||
std::string escapedstr =
|
||||
Base::Tools::escapedUnicodeFromUtf8(constraintName.toUtf8().constData());
|
||||
escapedstr = Base::Tools::escapeQuotesFromString(escapedstr);
|
||||
|
||||
@@ -129,13 +129,13 @@ public:
|
||||
if (value.isValid())
|
||||
return value;
|
||||
else
|
||||
return Base::Tools::fromStdString(
|
||||
return QString::fromStdString(
|
||||
Sketcher::PropertyConstraintList::getConstraintName(constraint->Name,
|
||||
ConstraintNbr));
|
||||
}
|
||||
else if (role == Qt::DisplayRole) {
|
||||
QString name =
|
||||
Base::Tools::fromStdString(Sketcher::PropertyConstraintList::getConstraintName(
|
||||
QString::fromStdString(Sketcher::PropertyConstraintList::getConstraintName(
|
||||
constraint->Name, ConstraintNbr));
|
||||
|
||||
switch (constraint->Type) {
|
||||
@@ -342,7 +342,7 @@ public:
|
||||
App::PropertyExpressionEngine::ExpressionInfo expr_info = sketch->getExpression(path);
|
||||
|
||||
if (expr_info.expression)
|
||||
return Base::Tools::fromStdString(expr_info.expression->toString());
|
||||
return QString::fromStdString(expr_info.expression->toString());
|
||||
else
|
||||
return QVariant();
|
||||
}
|
||||
@@ -1210,7 +1210,7 @@ void TaskSketcherConstraints::onListWidgetConstraintsItemChanged(QListWidgetItem
|
||||
const Sketcher::Constraint* v = vals[it->ConstraintNbr];
|
||||
const std::string currConstraintName = v->Name;
|
||||
|
||||
const std::string basename = Base::Tools::toStdString(it->data(Qt::EditRole).toString());
|
||||
const std::string basename = it->data(Qt::EditRole).toString().toStdString();
|
||||
|
||||
std::string newName(
|
||||
Sketcher::PropertyConstraintList::getConstraintName(basename, it->ConstraintNbr));
|
||||
@@ -1710,7 +1710,7 @@ void TaskSketcherConstraints::slotConstraintsChanged()
|
||||
QAbstractItemModel* model = ui->listWidgetConstraints->model();
|
||||
auto tmpBlock = model->blockSignals(true);
|
||||
it->setHidden(!visible);
|
||||
it->setData(Qt::EditRole, Base::Tools::fromStdString(constraint->Name));
|
||||
it->setData(Qt::EditRole, QString::fromStdString(constraint->Name));
|
||||
model->blockSignals(tmpBlock);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <Base/Quantity.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/UnitsApi.h>
|
||||
#include <Gui/CommandT.h>
|
||||
#include <Gui/Document.h>
|
||||
@@ -723,7 +722,7 @@ std::string SketcherGui::lengthToDisplayFormat(double value, int digits)
|
||||
QString qUserString = asQuantity.getUserString();
|
||||
if (Base::UnitsApi::isMultiUnitLength() || (!hideUnits() && useSystemDecimals())) {
|
||||
// just return the user string
|
||||
return Base::Tools::toStdString(qUserString);
|
||||
return qUserString.toStdString();
|
||||
}
|
||||
|
||||
// find the unit of measure
|
||||
@@ -738,24 +737,23 @@ std::string SketcherGui::lengthToDisplayFormat(double value, int digits)
|
||||
QRegularExpressionMatch match = rxNoUnits.match(qUserString);
|
||||
if (!match.hasMatch()) {
|
||||
// no units in userString?
|
||||
return Base::Tools::toStdString(qUserString);
|
||||
return qUserString.toStdString();
|
||||
}
|
||||
QString matched = match.captured(1); // matched is the numeric part of user string
|
||||
int dpPos = matched.indexOf(QLocale().decimalPoint());
|
||||
if (dpPos < 0) {
|
||||
auto ret = matched.toStdString();
|
||||
// no decimal separator (ie an integer), return all the digits
|
||||
if (hideUnits()) {
|
||||
return Base::Tools::toStdString(matched);
|
||||
}
|
||||
else {
|
||||
return Base::Tools::toStdString(matched + unitPart);
|
||||
if (!hideUnits()) {
|
||||
ret.append(unitPart.toStdString());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// real number
|
||||
if (useSystemDecimals() && hideUnits()) {
|
||||
// return just the numeric part of the user string
|
||||
return Base::Tools::toStdString(matched);
|
||||
return matched.toStdString();
|
||||
}
|
||||
|
||||
// real number and not using system decimals
|
||||
@@ -764,11 +762,11 @@ std::string SketcherGui::lengthToDisplayFormat(double value, int digits)
|
||||
// just take the whole thing
|
||||
requiredLength = matched.size();
|
||||
}
|
||||
QString numericPart = matched.left(requiredLength);
|
||||
if (hideUnits()) {
|
||||
return Base::Tools::toStdString(numericPart);
|
||||
auto numericPart = matched.left(requiredLength).toStdString();
|
||||
if (!hideUnits()) {
|
||||
numericPart.append(unitPart.toStdString());
|
||||
}
|
||||
return Base::Tools::toStdString(numericPart + unitPart);
|
||||
return numericPart;
|
||||
}
|
||||
|
||||
// convert value to display format %0.[digits]f. Units are always displayed for
|
||||
@@ -791,7 +789,7 @@ std::string SketcherGui::angleToDisplayFormat(double value, int digits)
|
||||
QString escapeSecond = QString::fromLatin1("\""); // substitute ascii double quote
|
||||
QString displayString = qUserString.replace(schemeMinute, escapeMinute);
|
||||
displayString = displayString.replace(schemeSecond, escapeSecond);
|
||||
return Base::Tools::toStdString(displayString);
|
||||
return displayString.toStdString();
|
||||
}
|
||||
|
||||
// we always use use U+00B0 (°) as the unit of measure for angles in
|
||||
@@ -805,19 +803,21 @@ std::string SketcherGui::angleToDisplayFormat(double value, int digits)
|
||||
QRegularExpressionMatch match = rxNoUnits.match(qUserString);
|
||||
if (!match.hasMatch()) {
|
||||
// no units in userString?
|
||||
return Base::Tools::toStdString(qUserString);
|
||||
return qUserString.toStdString();
|
||||
}
|
||||
QString matched = match.captured(1); // matched is the numeric part of user string
|
||||
auto smatched = matched.toStdString();
|
||||
auto sUnitString = qUnitString.toStdString();
|
||||
int dpPos = matched.indexOf(decimalSep);
|
||||
if (dpPos < 0) {
|
||||
// no decimal separator (ie an integer), return all the digits
|
||||
return Base::Tools::toStdString(matched + qUnitString);
|
||||
return smatched + sUnitString;
|
||||
}
|
||||
|
||||
// real number
|
||||
if (useSystemDecimals()) {
|
||||
// return just the numeric part of the user string + degree symbol
|
||||
return Base::Tools::toStdString(matched + qUnitString);
|
||||
return smatched + sUnitString;
|
||||
}
|
||||
|
||||
// real number and not using system decimals
|
||||
@@ -826,8 +826,9 @@ std::string SketcherGui::angleToDisplayFormat(double value, int digits)
|
||||
// just take the whole thing
|
||||
requiredLength = matched.size();
|
||||
}
|
||||
QString numericPart = matched.left(requiredLength);
|
||||
return Base::Tools::toStdString(numericPart + qUnitString);
|
||||
auto numericPart = matched.left(requiredLength).toStdString();
|
||||
numericPart.append(sUnitString);
|
||||
return numericPart;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Quantity.h>
|
||||
#include <Base/Reader.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/UnitsApi.h>
|
||||
#include <Base/Writer.h>
|
||||
|
||||
@@ -1090,7 +1089,6 @@ App::Color Cell::decodeColor(const std::string& color, const App::Color& default
|
||||
// roughly based on Spreadsheet/Gui/SheetModel.cpp
|
||||
std::string Cell::getFormattedQuantity()
|
||||
{
|
||||
std::string result;
|
||||
QString qFormatted;
|
||||
App::CellAddress thisCell = getAddress();
|
||||
Property* prop = owner->sheet()->getPropertyByName(thisCell.toString().c_str());
|
||||
@@ -1111,7 +1109,7 @@ std::string Cell::getFormattedQuantity()
|
||||
if (computedUnit.isEmpty() || computedUnit == du.unit) {
|
||||
QString number =
|
||||
QLocale().toString(rawVal / duScale, 'f', Base::UnitsApi::getDecimals());
|
||||
qFormatted = number + Base::Tools::fromStdString(" " + displayUnit.stringRep);
|
||||
qFormatted = number + QString::fromStdString(" " + displayUnit.stringRep);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1124,7 +1122,7 @@ std::string Cell::getFormattedQuantity()
|
||||
if (hasDisplayUnit) {
|
||||
QString number =
|
||||
QLocale().toString(rawVal / duScale, 'f', Base::UnitsApi::getDecimals());
|
||||
qFormatted = number + Base::Tools::fromStdString(" " + displayUnit.stringRep);
|
||||
qFormatted = number + QString::fromStdString(" " + displayUnit.stringRep);
|
||||
}
|
||||
}
|
||||
else if (prop->isDerivedFrom(App::PropertyInteger::getClassTypeId())) {
|
||||
@@ -1137,9 +1135,8 @@ std::string Cell::getFormattedQuantity()
|
||||
if (hasDisplayUnit) {
|
||||
QString number =
|
||||
QLocale().toString(rawVal / duScale, 'f', Base::UnitsApi::getDecimals());
|
||||
qFormatted = number + Base::Tools::fromStdString(" " + displayUnit.stringRep);
|
||||
qFormatted = number + QString::fromStdString(" " + displayUnit.stringRep);
|
||||
}
|
||||
}
|
||||
result = Base::Tools::toStdString(qFormatted);
|
||||
return result;
|
||||
return qFormatted.toStdString();
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#include <Base/FileInfo.h>
|
||||
#include <Base/Reader.h>
|
||||
#include <Base/Stream.h>
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include "Sheet.h"
|
||||
#include "SheetObserver.h"
|
||||
@@ -907,7 +906,7 @@ void Sheet::recomputeCell(CellAddress p)
|
||||
catch (const Base::Exception& e) {
|
||||
QString msg = QString::fromUtf8("ERR: %1").arg(QString::fromUtf8(e.what()));
|
||||
|
||||
setStringProperty(p, Base::Tools::toStdString(msg));
|
||||
setStringProperty(p, msg.toStdString());
|
||||
if (cell) {
|
||||
cell->setException(e.what());
|
||||
}
|
||||
|
||||
@@ -111,9 +111,9 @@ PropertiesDialog::PropertiesDialog(Sheet* _sheet,
|
||||
ui->styleUnderline->setChecked(true);
|
||||
}
|
||||
|
||||
ui->displayUnit->setText(Base::Tools::fromStdString(displayUnit.stringRep));
|
||||
ui->displayUnit->setText(QString::fromStdString(displayUnit.stringRep));
|
||||
|
||||
ui->alias->setText(Base::Tools::fromStdString(alias));
|
||||
ui->alias->setText(QString::fromStdString(alias));
|
||||
|
||||
// Colors
|
||||
connect(ui->foregroundColor,
|
||||
@@ -241,9 +241,9 @@ void PropertiesDialog::aliasChanged(const QString& text)
|
||||
{
|
||||
QPalette palette = ui->alias->palette();
|
||||
|
||||
aliasOk = text.isEmpty() || sheet->isValidAlias(Base::Tools::toStdString(text));
|
||||
aliasOk = text.isEmpty() || sheet->isValidAlias(text.toStdString());
|
||||
|
||||
alias = aliasOk ? Base::Tools::toStdString(text) : "";
|
||||
alias = aliasOk ? text.toStdString() : "";
|
||||
palette.setColor(QPalette::Text, aliasOk ? Qt::black : Qt::red);
|
||||
ui->alias->setPalette(palette);
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(displayUnitOk && aliasOk);
|
||||
|
||||
@@ -57,12 +57,12 @@ SheetModel::SheetModel(Sheet* _sheet, QObject* parent)
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/Mod/Spreadsheet");
|
||||
aliasBgColor =
|
||||
QColor(Base::Tools::fromStdString(hGrp->GetASCII("AliasedCellBackgroundColor", "#feff9e")));
|
||||
textFgColor = QColor(Base::Tools::fromStdString(hGrp->GetASCII("TextColor", "#000000")));
|
||||
QColor(QString::fromStdString(hGrp->GetASCII("AliasedCellBackgroundColor", "#feff9e")));
|
||||
textFgColor = QColor(QString::fromStdString(hGrp->GetASCII("TextColor", "#000000")));
|
||||
positiveFgColor =
|
||||
QColor(Base::Tools::fromStdString(hGrp->GetASCII("PositiveNumberColor", "#000000")));
|
||||
QColor(QString::fromStdString(hGrp->GetASCII("PositiveNumberColor", "#000000")));
|
||||
negativeFgColor =
|
||||
QColor(Base::Tools::fromStdString(hGrp->GetASCII("NegativeNumberColor", "#000000")));
|
||||
QColor(QString::fromStdString(hGrp->GetASCII("NegativeNumberColor", "#000000")));
|
||||
}
|
||||
|
||||
SheetModel::~SheetModel()
|
||||
@@ -145,7 +145,7 @@ QVariant SheetModel::data(const QModelIndex& index, int role) const
|
||||
if (!cell->hasException() && role == Qt::ToolTipRole) {
|
||||
std::string alias;
|
||||
if (cell->getAlias(alias)) {
|
||||
return QVariant(Base::Tools::fromStdString(alias));
|
||||
return QVariant(QString::fromStdString(alias));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -153,7 +153,7 @@ QVariant SheetModel::data(const QModelIndex& index, int role) const
|
||||
if (cell->hasException()) {
|
||||
switch (role) {
|
||||
case Qt::ToolTipRole: {
|
||||
QString txt(Base::Tools::fromStdString(cell->getException()).toHtmlEscaped());
|
||||
QString txt(QString::fromStdString(cell->getException()).toHtmlEscaped());
|
||||
return QVariant(QString::fromLatin1("<pre>%1</pre>").arg(txt));
|
||||
}
|
||||
case Qt::DisplayRole: {
|
||||
@@ -367,7 +367,7 @@ QVariant SheetModel::data(const QModelIndex& index, int role) const
|
||||
Base::UnitsApi::getDecimals());
|
||||
// QString number = QString::number(floatProp->getValue() /
|
||||
// displayUnit.scaler);
|
||||
v = number + Base::Tools::fromStdString(" " + displayUnit.stringRep);
|
||||
v = number + QString::fromStdString(" " + displayUnit.stringRep);
|
||||
}
|
||||
else {
|
||||
v = QString::fromUtf8("#ERR: unit");
|
||||
@@ -439,7 +439,7 @@ QVariant SheetModel::data(const QModelIndex& index, int role) const
|
||||
'f',
|
||||
Base::UnitsApi::getDecimals());
|
||||
// QString number = QString::number(d / displayUnit.scaler);
|
||||
v = number + Base::Tools::fromStdString(" " + displayUnit.stringRep);
|
||||
v = number + QString::fromStdString(" " + displayUnit.stringRep);
|
||||
}
|
||||
else if (!isInteger) {
|
||||
v = QLocale::system().toString(d, 'f', Base::UnitsApi::getDecimals());
|
||||
|
||||
@@ -432,7 +432,7 @@ void SheetView::confirmAliasChanged(const QString& text)
|
||||
bool aliasOkay = true;
|
||||
|
||||
ui->cellAlias->setDocumentObject(sheet);
|
||||
if (text.length() != 0 && !sheet->isValidAlias(Base::Tools::toStdString(text))) {
|
||||
if (text.length() != 0 && !sheet->isValidAlias(text.toStdString())) {
|
||||
aliasOkay = false;
|
||||
}
|
||||
|
||||
@@ -444,8 +444,7 @@ void SheetView::confirmAliasChanged(const QString& text)
|
||||
std::string current_alias;
|
||||
(void)cell->getAlias(current_alias);
|
||||
if (text != QString::fromUtf8(current_alias.c_str())) {
|
||||
Base::Console().Error("Unable to set alias: %s\n",
|
||||
Base::Tools::toStdString(text).c_str());
|
||||
Base::Console().Error("Unable to set alias: %s\n", text.toStdString().c_str());
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -479,7 +478,7 @@ void SheetView::aliasChanged(const QString& text)
|
||||
warningColor = QLatin1String("rgb(200,0,0)"); // Dark red for light mode
|
||||
}
|
||||
|
||||
if (!text.isEmpty() && !sheet->isValidAlias(Base::Tools::toStdString(text))) {
|
||||
if (!text.isEmpty() && !sheet->isValidAlias(text.toStdString())) {
|
||||
aliasOk = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/UnitsApi.h>
|
||||
|
||||
#include "DimensionFormatter.h"
|
||||
@@ -90,7 +89,7 @@ std::string DimensionFormatter::formatValue(const qreal value,
|
||||
QString formatSpecifier = qsl[2]; //FormatSpec specifier
|
||||
|
||||
QString qMultiValueStr;
|
||||
QString qBasicUnit = Base::Tools::fromStdString(Base::UnitsApi::getBasicLengthUnit());
|
||||
QString qBasicUnit = QString::fromStdString(Base::UnitsApi::getBasicLengthUnit());
|
||||
|
||||
QString formattedValue;
|
||||
if (isMultiValueSchema() && partial == 0) {
|
||||
@@ -102,7 +101,7 @@ std::string DimensionFormatter::formatValue(const qreal value,
|
||||
if (formatSpecifier.isEmpty()) {
|
||||
Base::Console().Warning("Warning - no numeric format in Format Spec %s - %s\n",
|
||||
qPrintable(qFormatSpec), m_dimension->getNameInDocument());
|
||||
return Base::Tools::toStdString(qFormatSpec);
|
||||
return qFormatSpec.toStdString();
|
||||
}
|
||||
|
||||
// for older TD drawings the formatSpecifier "%g" was used, but the number of decimals was
|
||||
@@ -158,45 +157,44 @@ std::string DimensionFormatter::formatValue(const qreal value,
|
||||
//formattedValue is now in formatSpec format with local decimal separator
|
||||
std::string formattedValueString = formattedValue.toStdString();
|
||||
if (partial == 0) { //prefix + unit subsystem string + suffix
|
||||
return Base::Tools::toStdString(formatPrefix) +
|
||||
Base::Tools::toStdString(qUserString) +
|
||||
Base::Tools::toStdString(formatSuffix);
|
||||
return formatPrefix.toStdString() +
|
||||
qUserString.toStdString() +
|
||||
formatSuffix.toStdString();
|
||||
}
|
||||
else if (partial == 1) { // prefix number[unit] suffix
|
||||
if (angularMeasure) {
|
||||
//always insert unit after value
|
||||
return Base::Tools::toStdString(formatPrefix) +
|
||||
formattedValueString + "°" +
|
||||
Base::Tools::toStdString(formatSuffix);
|
||||
return formatPrefix.toStdString() + formattedValueString + "°" +
|
||||
formatSuffix.toStdString();
|
||||
}
|
||||
else if (m_dimension->showUnits() || areaMeasure){
|
||||
if (isDim && m_dimension->haveTolerance()) {
|
||||
//unit will be included in tolerance so don't repeat it here
|
||||
return Base::Tools::toStdString(formatPrefix) +
|
||||
return formatPrefix.toStdString() +
|
||||
formattedValueString +
|
||||
Base::Tools::toStdString(formatSuffix);
|
||||
formatSuffix.toStdString();
|
||||
}
|
||||
else {
|
||||
//no tolerance, so we need to include unit
|
||||
return Base::Tools::toStdString(formatPrefix) +
|
||||
return formatPrefix.toStdString() +
|
||||
formattedValueString + " " +
|
||||
Base::Tools::toStdString(qBasicUnit) +
|
||||
Base::Tools::toStdString(formatSuffix);
|
||||
qBasicUnit.toStdString() +
|
||||
formatSuffix.toStdString();
|
||||
}
|
||||
}
|
||||
else {
|
||||
//showUnits is false
|
||||
return Base::Tools::toStdString(formatPrefix) +
|
||||
return formatPrefix.toStdString() +
|
||||
formattedValueString +
|
||||
Base::Tools::toStdString(formatSuffix);
|
||||
formatSuffix.toStdString();
|
||||
}
|
||||
}
|
||||
else if (partial == 2) { // just the unit
|
||||
if (angularMeasure) {
|
||||
return Base::Tools::toStdString(qBasicUnit);
|
||||
return qBasicUnit.toStdString();
|
||||
}
|
||||
else if (m_dimension->showUnits() || areaMeasure) {
|
||||
return Base::Tools::toStdString(qBasicUnit);
|
||||
return qBasicUnit.toStdString();
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
@@ -318,14 +316,14 @@ QString DimensionFormatter::formatValueToSpec(const double value, const QString&
|
||||
QString fs = formatSpecifier;
|
||||
fs.replace(QRegularExpression(QStringLiteral("%(.*)w")), QStringLiteral("%\\1f"));
|
||||
fs.replace(QRegularExpression(QStringLiteral("%(.*)W")), QStringLiteral("%\\1F"));
|
||||
formattedValue = QString::asprintf(Base::Tools::toStdString(fs).c_str(), value);
|
||||
formattedValue = QString::asprintf(fs.toStdString().c_str(), value);
|
||||
// First, try to cut trailing zeros, if AFTER decimal dot there are nonzero numbers
|
||||
// Second, try to cut also decimal dot and zeros, if there are just zeros after it
|
||||
formattedValue.replace(QRegularExpression(QStringLiteral("([0-9][0-9]*\\.[0-9]*[1-9])00*$")), QStringLiteral("\\1"));
|
||||
formattedValue.replace(QRegularExpression(QStringLiteral("([0-9][0-9]*)\\.0*$")), QStringLiteral("\\1"));
|
||||
} else {
|
||||
if (isNumericFormat(formatSpecifier)) {
|
||||
formattedValue = QString::asprintf(Base::Tools::toStdString(formatSpecifier).c_str(), value);
|
||||
formattedValue = QString::asprintf(formatSpecifier.toStdString().c_str(), value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,8 +372,8 @@ std::string DimensionFormatter::getDefaultFormatSpec(bool isToleranceFormat) con
|
||||
QString formatSpec;
|
||||
QString qPrefix;
|
||||
if (prefFormat.empty()) {
|
||||
QString format1 = Base::Tools::fromStdString("%.");
|
||||
QString format2 = Base::Tools::fromStdString("f");
|
||||
QString format1 = QString::fromStdString("%.");
|
||||
QString format2 = QString::fromStdString("f");
|
||||
int precision;
|
||||
if (m_dimension->useDecimals()) {
|
||||
precision = Base::UnitsApi::getDecimals();
|
||||
@@ -403,7 +401,7 @@ std::string DimensionFormatter::getDefaultFormatSpec(bool isToleranceFormat) con
|
||||
formatSpec.replace(QString::fromUtf8("%"), QString::fromUtf8("%+"));
|
||||
}
|
||||
|
||||
return Base::Tools::toStdString(formatSpec);
|
||||
return formatSpec.toStdString();
|
||||
}
|
||||
|
||||
//true if value is too small to display using formatSpec
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include <Base/Console.h>
|
||||
#include <Base/FileInfo.h>
|
||||
#include <Base/Quantity.h>
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include "DrawPage.h"
|
||||
#include "DrawSVGTemplate.h"
|
||||
@@ -205,7 +204,7 @@ bool DrawSVGTemplate::getTemplateDocument(std::string sourceFile, QDomDocument&
|
||||
if (sourceFile.empty()) {
|
||||
return false;
|
||||
}
|
||||
QFile templateFile(Base::Tools::fromStdString(sourceFile));
|
||||
QFile templateFile(QString::fromStdString(sourceFile));
|
||||
if (!templateFile.open(QIODevice::ReadOnly)) {
|
||||
Base::Console().Error("DrawSVGTemplate::processTemplate can't read embedded template %s!\n", PageResult.getValue());
|
||||
return false;
|
||||
|
||||
@@ -61,7 +61,6 @@
|
||||
#include <Base/FileInfo.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Stream.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/UnitsApi.h>
|
||||
#include <Base/Vector3D.h>
|
||||
|
||||
@@ -1861,8 +1860,7 @@ std::string DrawUtil::translateArbitrary(std::string context, std::string baseNa
|
||||
suffix = uniqueName.substr(baseName.length(), uniqueName.length() - baseName.length());
|
||||
}
|
||||
QString qTranslated = qApp->translate(context.c_str(), baseName.c_str());
|
||||
std::string ssTranslated = Base::Tools::toStdString(qTranslated);
|
||||
return ssTranslated + suffix;
|
||||
return qTranslated.toStdString() + suffix;
|
||||
}
|
||||
|
||||
// true if owner->element is a cosmetic vertex
|
||||
|
||||
@@ -273,7 +273,7 @@ std::string DrawViewSpreadsheet::getSheetImage()
|
||||
if (prop->isDerivedFrom(App::PropertyQuantity::getClassTypeId())) {
|
||||
auto contentAsQuantity = static_cast<App::PropertyQuantity*>(prop)->getQuantityValue();
|
||||
auto ustring = contentAsQuantity.getUserString();
|
||||
field << Base::Tools::toStdString(ustring);
|
||||
field << ustring.toStdString();
|
||||
} else if (prop->isDerivedFrom(App::PropertyFloat::getClassTypeId()) ||
|
||||
prop->isDerivedFrom(App::PropertyInteger::getClassTypeId())) {
|
||||
std::string temp = cell->getFormattedQuantity();
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Interpreter.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Language/Translator.h>
|
||||
#include <Gui/WidgetFactory.h>
|
||||
@@ -90,7 +89,7 @@ void loadTechDrawResource()
|
||||
{"osifont-lgpl3fe.ttf", "osifont-italic.ttf", "Y14.5-2018.ttf", "Y14.5-FreeCAD.ttf"});
|
||||
|
||||
for (auto& font : fontsAll) {
|
||||
QString fontFile = Base::Tools::fromStdString(fontDir + font);
|
||||
QString fontFile = QString::fromStdString(fontDir + font);
|
||||
int rc = QFontDatabase::addApplicationFont(fontFile);
|
||||
if (rc < 0) {
|
||||
Base::Console().Warning(
|
||||
|
||||
@@ -138,7 +138,7 @@ void CmdTechDrawPageDefault::activated(int iMsg)
|
||||
svgTemplate->translateLabel("DrawSVGTemplate", "Template", svgTemplate->getNameInDocument());
|
||||
|
||||
page->Template.setValue(svgTemplate);
|
||||
auto filespec = DU::cleanFilespecBackslash(Base::Tools::toStdString(templateFileName));
|
||||
auto filespec = DU::cleanFilespecBackslash(templateFileName.toStdString());
|
||||
svgTemplate->Template.setValue(filespec);
|
||||
|
||||
updateActive();
|
||||
@@ -209,7 +209,7 @@ void CmdTechDrawPageTemplate::activated(int iMsg)
|
||||
svgTemplate->translateLabel("DrawSVGTemplate", "Template", svgTemplate->getNameInDocument());
|
||||
|
||||
page->Template.setValue(svgTemplate);
|
||||
auto filespec = DU::cleanFilespecBackslash(Base::Tools::toStdString(templateFileName));
|
||||
auto filespec = DU::cleanFilespecBackslash(templateFileName.toStdString());
|
||||
svgTemplate->Template.setValue(filespec);
|
||||
|
||||
updateActive();
|
||||
@@ -453,7 +453,7 @@ void CmdTechDrawView::activated(int iMsg)
|
||||
|| filename.endsWith(QString::fromLatin1(".svgz"), Qt::CaseInsensitive)) {
|
||||
std::string FeatName = getUniqueObjectName("Symbol");
|
||||
filename = Base::Tools::escapeEncodeFilename(filename);
|
||||
auto filespec = DU::cleanFilespecBackslash(Base::Tools::toStdString(filename));
|
||||
auto filespec = DU::cleanFilespecBackslash(filename.toStdString());
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Create Symbol"));
|
||||
doCommand(Doc, "f = open(\"%s\", 'r')", filespec.c_str());
|
||||
doCommand(Doc, "svg = f.read()");
|
||||
@@ -469,7 +469,7 @@ void CmdTechDrawView::activated(int iMsg)
|
||||
else {
|
||||
std::string FeatName = getUniqueObjectName("Image");
|
||||
filename = Base::Tools::escapeEncodeFilename(filename);
|
||||
auto filespec = DU::cleanFilespecBackslash(Base::Tools::toStdString(filename));
|
||||
auto filespec = DU::cleanFilespecBackslash(filename.toStdString());
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Create Image"));
|
||||
doCommand(Doc, "App.activeDocument().addObject('TechDraw::DrawViewImage', '%s')", FeatName.c_str());
|
||||
doCommand(Doc, "App.activeDocument().%s.translateLabel('DrawViewImage', 'Image', '%s')",
|
||||
@@ -1548,7 +1548,7 @@ void CmdTechDrawSymbol::activated(int iMsg)
|
||||
if (!filename.isEmpty()) {
|
||||
std::string FeatName = getUniqueObjectName("Symbol");
|
||||
filename = Base::Tools::escapeEncodeFilename(filename);
|
||||
auto filespec = DU::cleanFilespecBackslash(Base::Tools::toStdString(filename));
|
||||
auto filespec = DU::cleanFilespecBackslash(filename.toStdString());
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Create Symbol"));
|
||||
doCommand(Doc, "f = open(\"%s\", 'r')", (const char*)filespec.c_str());
|
||||
doCommand(Doc, "svg = f.read()");
|
||||
@@ -1863,7 +1863,7 @@ void CmdTechDrawExportPageDXF::activated(int iMsg)
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Save page to DXF"));
|
||||
doCommand(Doc, "import TechDraw");
|
||||
fileName = Base::Tools::escapeEncodeFilename(fileName);
|
||||
auto filespec = DU::cleanFilespecBackslash(Base::Tools::toStdString(fileName));
|
||||
auto filespec = DU::cleanFilespecBackslash(fileName.toStdString());
|
||||
doCommand(Doc, "TechDraw.writeDXFPage(App.activeDocument().%s, u\"%s\")", PageName.c_str(),
|
||||
filespec.c_str());
|
||||
commitCommand();
|
||||
|
||||
@@ -267,7 +267,7 @@ void CmdTechDrawImage::activated(int iMsg)
|
||||
|
||||
std::string FeatName = getUniqueObjectName("Image");
|
||||
fileName = Base::Tools::escapeEncodeFilename(fileName);
|
||||
auto filespec = DU::cleanFilespecBackslash(Base::Tools::toStdString(fileName));
|
||||
auto filespec = DU::cleanFilespecBackslash(fileName.toStdString());
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Create Image"));
|
||||
doCommand(Doc, "App.activeDocument().addObject('TechDraw::DrawViewImage', '%s')", FeatName.c_str());
|
||||
doCommand(Doc, "App.activeDocument().%s.translateLabel('DrawViewImage', 'Image', '%s')",
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/Type.h>
|
||||
#include <Gui/Action.h>
|
||||
#include <Gui/Application.h>
|
||||
@@ -1846,7 +1845,7 @@ void CmdTechDrawExtensionAreaAnnotation::activated(int iMsg)
|
||||
qUserString.chop(2);
|
||||
qUserString.append(QString::fromUtf8("²"));
|
||||
}
|
||||
std::string sUserString = Base::Tools::toStdString(qUserString);
|
||||
std::string sUserString = qUserString.toStdString();
|
||||
|
||||
// set the attributes in the data tab's fields
|
||||
// balloon->SourceView.setValue(objFeat);
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h> // for FC_LOG_LEVEL_INIT
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include "DlgPageChooser.h"
|
||||
#include "ui_DlgPageChooser.h"
|
||||
@@ -72,8 +71,8 @@ void DlgPageChooser::fillList(std::vector<std::string> labels, std::vector<std::
|
||||
int labelCount = labels.size();
|
||||
int i = 0;
|
||||
for (; i < labelCount; i++) {
|
||||
qLabel = Base::Tools::fromStdString(labels[i]);
|
||||
qName = Base::Tools::fromStdString(names[i]);
|
||||
qLabel = QString::fromStdString(labels[i]);
|
||||
qName = QString::fromStdString(names[i]);
|
||||
qText = QString::fromUtf8("%1 (%2)").arg(qLabel, qName);
|
||||
item = new QListWidgetItem(qText, ui->lwPages);
|
||||
item->setData(Qt::UserRole, qName);
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include <Base/Tools.h>
|
||||
#include <App/Application.h>
|
||||
|
||||
#include "DlgPrefsTechDrawDimensionsImp.h"
|
||||
@@ -150,7 +149,7 @@ void DlgPrefsTechDrawDimensionsImp::loadSettings()
|
||||
DrawGuiUtil::loadArrowBox(ui->pcbArrow);
|
||||
ui->pcbArrow->setCurrentIndex(prefArrowStyle());
|
||||
|
||||
ui->leFormatSpec->setText(Base::Tools::fromStdString(Preferences::formatSpec()));
|
||||
ui->leFormatSpec->setText(QString::fromStdString(Preferences::formatSpec()));
|
||||
ui->leFormatSpec->onRestore();
|
||||
|
||||
ui->pdsbGapISO->onRestore();
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
# include <QListWidgetItem>
|
||||
#endif
|
||||
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include "DlgStringListEditor.h"
|
||||
#include "ui_DlgStringListEditor.h"
|
||||
|
||||
@@ -70,7 +68,7 @@ void DlgStringListEditor::fillList(std::vector<std::string> texts)
|
||||
int textCount = texts.size();
|
||||
int i = 0;
|
||||
for (; i < textCount; i++) {
|
||||
qText = Base::Tools::fromStdString(texts[i]);
|
||||
qText = QString::fromStdString(texts[i]);
|
||||
QListWidgetItem* item = new QListWidgetItem(qText);
|
||||
item->setFlags(item->flags() | Qt::ItemIsEditable);
|
||||
ui->lwTexts->addItem(item);
|
||||
@@ -125,7 +123,7 @@ std::vector<std::string> DlgStringListEditor::getTexts() const
|
||||
|
||||
for (int iRow = 0; iRow < ui->lwTexts->count(); iRow++) {
|
||||
QString itemText = ui->lwTexts->item(iRow)->text();
|
||||
outTexts.push_back(Base::Tools::toStdString(itemText));
|
||||
outTexts.push_back(itemText.toStdString());
|
||||
}
|
||||
if (outTexts.back().empty()) {
|
||||
outTexts.pop_back();
|
||||
|
||||
@@ -164,7 +164,7 @@ void DrawGuiUtil::loadLineStandardsChoices(QComboBox* combo)
|
||||
combo->clear();
|
||||
std::vector<std::string> choices = LineGenerator::getAvailableLineStandards();
|
||||
for (auto& entry : choices) {
|
||||
QString qentry = Base::Tools::fromStdString(entry);
|
||||
QString qentry = QString::fromStdString(entry);
|
||||
combo->addItem(qentry);
|
||||
}
|
||||
}
|
||||
@@ -201,7 +201,7 @@ void DrawGuiUtil::loadLineGroupChoices(QComboBox* combo)
|
||||
std::stringstream ss(lgRecord);
|
||||
std::vector<QString> lgNames;
|
||||
while (std::getline(ss, lgRecord, ',')) {
|
||||
lgNames.push_back(Base::Tools::fromStdString(lgRecord));
|
||||
lgNames.push_back(QString::fromStdString(lgRecord));
|
||||
}
|
||||
// fill the combobox with the found names
|
||||
for (auto& name : lgNames) {
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Stream.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Document.h>
|
||||
@@ -136,7 +135,7 @@ void MDIViewPage::setScene(QGSPage* scene, QGVPage* viewWidget)
|
||||
void MDIViewPage::setDocumentObject(const std::string& name)
|
||||
{
|
||||
m_objectName = name;
|
||||
setObjectName(Base::Tools::fromStdString(name));
|
||||
setObjectName(QString::fromStdString(name));
|
||||
}
|
||||
|
||||
void MDIViewPage::setDocumentName(const std::string& name) { m_documentName = name; }
|
||||
@@ -480,7 +479,7 @@ void MDIViewPage::saveSVG()
|
||||
return;
|
||||
}
|
||||
static_cast<void>(blockSelection(true));// avoid to be notified by itself
|
||||
saveSVG(Base::Tools::toStdString(fn));
|
||||
saveSVG(fn.toStdString());
|
||||
static_cast<void>(blockSelection(false));
|
||||
}
|
||||
|
||||
|
||||
@@ -348,7 +348,7 @@ void PagePrinter::printPdf(ViewProviderPage* vpPage, const std::string& file)
|
||||
filespec = DU::cleanFilespecBackslash(filespec);
|
||||
|
||||
// set up the pdfwriter
|
||||
QString outputFile = Base::Tools::fromStdString(filespec);
|
||||
QString outputFile = QString::fromStdString(filespec);
|
||||
QPdfWriter pdfWriter(outputFile);
|
||||
QPageLayout pageLayout = pdfWriter.pageLayout();
|
||||
auto marginsdb = pageLayout.margins(QPageLayout::Millimeter);
|
||||
@@ -396,7 +396,7 @@ void PagePrinter::saveSVG(ViewProviderPage* vpPage, const std::string& file)
|
||||
}
|
||||
auto filespec = Base::Tools::escapeEncodeFilename(file);
|
||||
filespec = DU::cleanFilespecBackslash(file);
|
||||
QString filename = Base::Tools::fromStdString(filespec);
|
||||
QString filename = QString::fromStdString(filespec);
|
||||
|
||||
auto ourScene = vpPage->getQGSPage();
|
||||
ourScene->setExportingSvg(true);
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
# include <QStyleOptionGraphicsItem>
|
||||
#endif
|
||||
|
||||
#include <Base/Tools.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
|
||||
#include "QGIHighlight.h"
|
||||
@@ -100,7 +99,7 @@ void QGIHighlight::makeHighlight()
|
||||
void QGIHighlight::makeReference()
|
||||
{
|
||||
prepareGeometryChange();
|
||||
int fontSize = QGIView::exactFontSize(Base::Tools::toStdString(m_refFont.family()),
|
||||
int fontSize = QGIView::exactFontSize(m_refFont.family().toStdString(),
|
||||
m_refSize);
|
||||
m_refFont .setPixelSize(fontSize);
|
||||
m_reference->setFont(m_refFont);
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <App/Application.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawSVGTemplate.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
@@ -195,7 +194,7 @@ void QGISVGTemplate::createClickHandles()
|
||||
"QGISVGTemplate::createClickHandles - no name for editable text at %f, %f\n", x, y);
|
||||
return true;
|
||||
}
|
||||
std::string editableNameString = textMap[Base::Tools::toStdString(name)];
|
||||
std::string editableNameString = textMap[name.toStdString()];
|
||||
|
||||
// default box size
|
||||
double textHeight{0};
|
||||
@@ -217,7 +216,7 @@ void QGISVGTemplate::createClickHandles()
|
||||
QFont fontForLength(Preferences::labelFontQString());
|
||||
fontForLength.setPixelSize(textHeight);
|
||||
textItemForLength.setFont(fontForLength);
|
||||
textItemForLength.setPlainText(Base::Tools::fromStdString(editableNameString));
|
||||
textItemForLength.setPlainText(QString::fromStdString(editableNameString));
|
||||
auto brect = textItemForLength.boundingRect();
|
||||
auto newLength = brect.width();
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <App/Application.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include <Mod/TechDraw/App/Preferences.h>
|
||||
|
||||
@@ -208,7 +207,7 @@ void QGISectionLine::makeSymbols()
|
||||
void QGISectionLine::makeSymbolsTrad()
|
||||
{
|
||||
prepareGeometryChange();
|
||||
int fontSize = QGIView::exactFontSize(Base::Tools::toStdString(m_symFont.family()), m_symSize);
|
||||
int fontSize = QGIView::exactFontSize(m_symFont.family().toStdString(), m_symSize);
|
||||
m_symFont.setPixelSize(fontSize);
|
||||
m_symbol1->setFont(m_symFont);
|
||||
m_symbol1->setPlainText(QString::fromUtf8(m_symbol));
|
||||
@@ -238,7 +237,7 @@ void QGISectionLine::makeSymbolsTrad()
|
||||
void QGISectionLine::makeSymbolsISO()
|
||||
{
|
||||
prepareGeometryChange();
|
||||
int fontSize = QGIView::exactFontSize(Base::Tools::toStdString(m_symFont.family()), m_symSize);
|
||||
int fontSize = QGIView::exactFontSize(m_symFont.family().toStdString(), m_symSize);
|
||||
m_symFont.setPixelSize(fontSize);
|
||||
m_symbol1->setFont(m_symFont);
|
||||
m_symbol1->setPlainText(QString::fromUtf8(m_symbol));
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <Base/FileInfo.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Stream.h>
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawTileWeld.h>
|
||||
|
||||
@@ -262,7 +261,7 @@ void QGITile::setFont(QFont f, double fSizePx)
|
||||
|
||||
void QGITile::setFont(std::string fName, double fSizePx)
|
||||
{
|
||||
QString qFName = Base::Tools::fromStdString(fName);
|
||||
QString qFName = QString::fromStdString(fName);
|
||||
QFont f(qFName);
|
||||
setFont(f, fSizePx);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawLeaderLine.h>
|
||||
#include <Mod/TechDraw/App/DrawTile.h>
|
||||
@@ -254,7 +253,7 @@ void QGIWeldSymbol::drawTailText()
|
||||
if (!vp) {
|
||||
return;
|
||||
}
|
||||
QString qFontName = Base::Tools::fromStdString(vp->Font.getValue());
|
||||
QString qFontName = QString::fromStdString(vp->Font.getValue());
|
||||
int fontSize = QGIView::exactFontSize(vp->Font.getValue(),
|
||||
vp->FontSize.getValue());
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
#include <App/Document.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
@@ -203,7 +202,7 @@ TechDraw::DrawViewImage* TaskActiveView::createActiveView()
|
||||
QImage::Format_RGB32); //arbitrary initial image size.
|
||||
image.fill(QColor(Qt::transparent));
|
||||
Grabber3d::quickView(view3d, bg, image);
|
||||
bool success = image.save(Base::Tools::fromStdString(tempName));
|
||||
bool success = image.save(QString::fromStdString(tempName));
|
||||
|
||||
if (!success) {
|
||||
Base::Console().Error("ActiveView could not save file: %s\n", fileSpec.c_str());
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/UnitsApi.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
@@ -170,9 +169,9 @@ void TaskCenterLine::setUiPrimary()
|
||||
|
||||
if (m_partFeat) {
|
||||
std::string baseName = m_partFeat->getNameInDocument();
|
||||
ui->leBaseView->setText(Base::Tools::fromStdString(baseName));
|
||||
ui->leBaseView->setText(QString::fromStdString(baseName));
|
||||
for (auto& s: m_subNames) {
|
||||
QString listItem = Base::Tools::fromStdString(s);
|
||||
QString listItem = QString::fromStdString(s);
|
||||
ui->lstSubList->addItem(listItem);
|
||||
}
|
||||
}
|
||||
@@ -212,8 +211,8 @@ void TaskCenterLine::setUiEdit()
|
||||
setWindowTitle(QObject::tr("Edit Center Line"));
|
||||
if (m_partFeat) {
|
||||
std::string baseName = m_partFeat->getNameInDocument();
|
||||
ui->leBaseView->setText(Base::Tools::fromStdString(baseName));
|
||||
QString listItem = Base::Tools::fromStdString(m_edgeName);
|
||||
ui->leBaseView->setText(QString::fromStdString(baseName));
|
||||
QString listItem = QString::fromStdString(m_edgeName);
|
||||
ui->lstSubList->addItem(listItem);
|
||||
}
|
||||
ui->cpLineColor->setColor(m_cl->m_format.getColor().asValue<QColor>());
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <App/Document.h>
|
||||
#include <App/Link.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Control.h>
|
||||
@@ -149,13 +148,13 @@ void TaskComplexSection::setUiPrimary()
|
||||
setUiCommon();
|
||||
|
||||
if (m_baseView) {
|
||||
ui->leBaseView->setText(Base::Tools::fromStdString(m_baseView->getNameInDocument()));
|
||||
ui->leBaseView->setText(QString::fromStdString(m_baseView->getNameInDocument()));
|
||||
//if there is a baseView, we don't know the sectionNormal yet and have to wait until
|
||||
//one is picked in the dialog
|
||||
Base::Vector3d defaultNormal(-1.0, 0.0, 0.0);
|
||||
m_saveNormal = defaultNormal;
|
||||
m_saveXDir = Base::Vector3d(0.0, 1.0, 0.0);
|
||||
ui->leBaseView->setText(Base::Tools::fromStdString(m_baseView->getNameInDocument()));
|
||||
ui->leBaseView->setText(QString::fromStdString(m_baseView->getNameInDocument()));
|
||||
m_compass->setDialAngle(0.0);
|
||||
m_viewDirectionWidget->setValueNoNotify(Base::Vector3d(1.0, 0.0, 0.0));
|
||||
}
|
||||
@@ -179,10 +178,10 @@ void TaskComplexSection::setUiEdit()
|
||||
setWindowTitle(QObject::tr("Edit Complex Section"));
|
||||
|
||||
if (m_baseView) {
|
||||
ui->leBaseView->setText(Base::Tools::fromStdString(m_baseView->getNameInDocument()));
|
||||
ui->leBaseView->setText(QString::fromStdString(m_baseView->getNameInDocument()));
|
||||
}
|
||||
ui->cmbStrategy->setCurrentIndex(m_section->ProjectionStrategy.getValue());
|
||||
ui->leSymbol->setText(Base::Tools::fromStdString(m_section->SectionSymbol.getValue()));
|
||||
ui->leSymbol->setText(QString::fromStdString(m_section->SectionSymbol.getValue()));
|
||||
ui->sbScale->setValue(m_section->Scale.getValue());
|
||||
ui->cmbScaleType->setCurrentIndex(m_section->getScaleType());
|
||||
|
||||
@@ -190,7 +189,7 @@ void TaskComplexSection::setUiEdit()
|
||||
|
||||
Base::Vector3d sectionNormalVec = m_section->SectionNormal.getValue();
|
||||
if (m_baseView) {
|
||||
ui->leBaseView->setText(Base::Tools::fromStdString(m_baseView->getNameInDocument()));
|
||||
ui->leBaseView->setText(QString::fromStdString(m_baseView->getNameInDocument()));
|
||||
Base::Vector3d projectedViewDirection = m_baseView->projectPoint(sectionNormalVec, false);
|
||||
double viewAngle = atan2(-projectedViewDirection.y, -projectedViewDirection.x);
|
||||
m_compass->setDialAngle(viewAngle * 180.0 / M_PI);
|
||||
@@ -205,9 +204,9 @@ void TaskComplexSection::setUiEdit()
|
||||
void TaskComplexSection::setUiCommon()
|
||||
{
|
||||
ui->leSectionObjects->setText(sourcesToString());
|
||||
ui->leProfileObject->setText(Base::Tools::fromStdString(m_profileObject->getNameInDocument())
|
||||
ui->leProfileObject->setText(QString::fromStdString(m_profileObject->getNameInDocument())
|
||||
+ QString::fromUtf8(" / ")
|
||||
+ Base::Tools::fromStdString(m_profileObject->Label.getValue()));
|
||||
+ QString::fromStdString(m_profileObject->Label.getValue()));
|
||||
|
||||
m_compass = new CompassWidget(this);
|
||||
auto layout = ui->compassLayout;
|
||||
@@ -383,9 +382,9 @@ void TaskComplexSection::onProfileObjectsUseSelectionClicked()
|
||||
if (!selection.empty()) {
|
||||
m_profileObject = selection.front().getObject();
|
||||
ui->leProfileObject->setText(
|
||||
Base::Tools::fromStdString(m_profileObject->getNameInDocument())
|
||||
QString::fromStdString(m_profileObject->getNameInDocument())
|
||||
+ QString::fromUtf8(" / ")
|
||||
+ Base::Tools::fromStdString(m_profileObject->Label.getValue()));
|
||||
+ QString::fromStdString(m_profileObject->Label.getValue()));
|
||||
}
|
||||
}
|
||||
void TaskComplexSection::scaleTypeChanged(int index)
|
||||
@@ -452,25 +451,25 @@ QString TaskComplexSection::sourcesToString()
|
||||
QString currentSeparator;
|
||||
if (m_baseView) {
|
||||
for (auto& obj : m_baseView->Source.getValues()) {
|
||||
result += currentSeparator + Base::Tools::fromStdString(obj->getNameInDocument())
|
||||
+ QString::fromUtf8(" / ") + Base::Tools::fromStdString(obj->Label.getValue());
|
||||
result += currentSeparator + QString::fromStdString(obj->getNameInDocument())
|
||||
+ QString::fromUtf8(" / ") + QString::fromStdString(obj->Label.getValue());
|
||||
currentSeparator = separator;
|
||||
}
|
||||
currentSeparator = QString();
|
||||
for (auto& obj : m_baseView->XSource.getValues()) {
|
||||
result += currentSeparator + Base::Tools::fromStdString(obj->getNameInDocument())
|
||||
+ QString::fromUtf8(" / ") + Base::Tools::fromStdString(obj->Label.getValue());
|
||||
result += currentSeparator + QString::fromStdString(obj->getNameInDocument())
|
||||
+ QString::fromUtf8(" / ") + QString::fromStdString(obj->Label.getValue());
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (auto& obj : m_shapes) {
|
||||
result += currentSeparator + Base::Tools::fromStdString(obj->getNameInDocument())
|
||||
+ QString::fromUtf8(" / ") + Base::Tools::fromStdString(obj->Label.getValue());
|
||||
result += currentSeparator + QString::fromStdString(obj->getNameInDocument())
|
||||
+ QString::fromUtf8(" / ") + QString::fromStdString(obj->Label.getValue());
|
||||
}
|
||||
currentSeparator = QString();
|
||||
for (auto& obj : m_xShapes) {
|
||||
result += currentSeparator + Base::Tools::fromStdString(obj->getNameInDocument())
|
||||
+ QString::fromUtf8(" / ") + Base::Tools::fromStdString(obj->Label.getValue());
|
||||
result += currentSeparator + QString::fromStdString(obj->getNameInDocument())
|
||||
+ QString::fromUtf8(" / ") + QString::fromStdString(obj->Label.getValue());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -568,7 +567,7 @@ void TaskComplexSection::createComplexSection()
|
||||
// we pluck the generated suffix from the object name and append it to "Section" to generate
|
||||
// unique Labels
|
||||
QString qTemp = ui->leSymbol->text();
|
||||
std::string temp = Base::Tools::toStdString(qTemp);
|
||||
std::string temp = qTemp.toStdString();
|
||||
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.SectionSymbol = '%s'",
|
||||
m_sectionName.c_str(), temp.c_str());
|
||||
|
||||
@@ -653,7 +652,7 @@ void TaskComplexSection::updateComplexSection()
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Edit Section View"));
|
||||
if (m_section) {
|
||||
QString qTemp = ui->leSymbol->text();
|
||||
std::string temp = Base::Tools::toStdString(qTemp);
|
||||
std::string temp = qTemp.toStdString();
|
||||
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.SectionSymbol = '%s'",
|
||||
m_sectionName.c_str(), temp.c_str());
|
||||
|
||||
@@ -704,14 +703,14 @@ std::string TaskComplexSection::makeSectionLabel(QString symbol)
|
||||
const std::string objectName{QT_TR_NOOP("ComplexSection")};
|
||||
std::string uniqueSuffix{m_sectionName.substr(objectName.length(), std::string::npos)};
|
||||
std::string uniqueLabel = "Section" + uniqueSuffix;
|
||||
std::string temp = Base::Tools::toStdString(symbol);
|
||||
std::string temp = symbol.toStdString();
|
||||
return ( uniqueLabel + " " + temp + " - " + temp );
|
||||
}
|
||||
|
||||
void TaskComplexSection::failNoObject(void)
|
||||
{
|
||||
QString qsectionName = Base::Tools::fromStdString(m_sectionName);
|
||||
QString qbaseName = Base::Tools::fromStdString(m_saveBaseName);
|
||||
QString qsectionName = QString::fromStdString(m_sectionName);
|
||||
QString qbaseName = QString::fromStdString(m_saveBaseName);
|
||||
QString msg = tr("Can not continue. Object * %1 or %2 not found.").arg(qsectionName, qbaseName);
|
||||
QMessageBox::critical(Gui::getMainWindow(), QObject::tr("Operation Failed"), msg);
|
||||
Gui::Control().closeDialog();
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#endif // #ifndef _PreComp_
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/UnitsApi.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
@@ -110,7 +109,7 @@ void TaskCosVertex::setUiPrimary()
|
||||
|
||||
if (m_baseFeat) {
|
||||
std::string baseName = m_baseFeat->getNameInDocument();
|
||||
ui->leBaseView->setText(Base::Tools::fromStdString(baseName));
|
||||
ui->leBaseView->setText(QString::fromStdString(baseName));
|
||||
}
|
||||
ui->pbTracker->setText(tr("Point Picker"));
|
||||
ui->pbTracker->setEnabled(true);
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#endif
|
||||
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Mod/TechDraw/App/DrawViewBalloon.h>
|
||||
@@ -84,13 +83,13 @@ void TaskCustomizeFormat::setUiEdit()
|
||||
isDimension = true;
|
||||
std::string dimText = dim->FormatSpec.getStrValue();
|
||||
dimRawValue = dim->getDimValue();
|
||||
ui->leFormat->setText(Base::Tools::fromStdString(dimText));
|
||||
ui->leFormat->setText(QString::fromStdString(dimText));
|
||||
}
|
||||
else if (auto balloon = dynamic_cast<TechDraw::DrawViewBalloon*>(selectedObject))
|
||||
{
|
||||
isDimension = false;
|
||||
std::string balloonText = balloon->Text.getStrValue();
|
||||
ui->leFormat->setText(Base::Tools::fromStdString(balloonText));
|
||||
ui->leFormat->setText(QString::fromStdString(balloonText));
|
||||
}
|
||||
// GD&T
|
||||
connect(ui->pbA01, &QPushButton::clicked, this, &TaskCustomizeFormat::onSymbolClicked);
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include <App/Document.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/UnitsApi.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
@@ -242,7 +241,7 @@ void TaskDetail::setUiFromFeat()
|
||||
// Base::Console().Message("TD::setUIFromFeat()\n");
|
||||
if (m_baseFeat) {
|
||||
std::string baseName = getBaseFeat()->getNameInDocument();
|
||||
ui->leBaseView->setText(Base::Tools::fromStdString(baseName));
|
||||
ui->leBaseView->setText(QString::fromStdString(baseName));
|
||||
}
|
||||
|
||||
Base::Vector3d anchor;
|
||||
@@ -485,7 +484,7 @@ void TaskDetail::updateDetail()
|
||||
double radius = ui->qsbRadius->rawValue();
|
||||
detailFeat->Radius.setValue(radius);
|
||||
QString qRef = ui->leReference->text();
|
||||
std::string ref = Base::Tools::toStdString(qRef);
|
||||
std::string ref = qRef.toStdString();
|
||||
detailFeat->Reference.setValue(ref);
|
||||
|
||||
detailFeat->recomputeFeature();
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#endif// #ifndef _PreComp_
|
||||
|
||||
#include <App/Document.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
@@ -68,12 +67,12 @@ void TaskDimRepair::setUiPrimary()
|
||||
ui->leName->setReadOnly(true);
|
||||
ui->leLabel->setReadOnly(true);
|
||||
|
||||
ui->leName->setText(Base::Tools::fromStdString(m_dim->getNameInDocument()));
|
||||
ui->leLabel->setText(Base::Tools::fromStdString(m_dim->Label.getValue()));
|
||||
ui->leName->setText(QString::fromStdString(m_dim->getNameInDocument()));
|
||||
ui->leLabel->setText(QString::fromStdString(m_dim->Label.getValue()));
|
||||
|
||||
std::string objName = m_dim->getViewPart()->getNameInDocument();
|
||||
std::string objLabel = m_dim->getViewPart()->Label.getValue();
|
||||
ui->leObject2d->setText(Base::Tools::fromStdString(objName + " / " + objLabel));
|
||||
ui->leObject2d->setText(QString::fromStdString(objName + " / " + objLabel));
|
||||
const std::vector<std::string>& subElements2d = m_dim->References2D.getSubValues();
|
||||
std::vector<std::string> noLabels(subElements2d.size());
|
||||
fillList(ui->lwGeometry2d, subElements2d, noLabels);
|
||||
@@ -164,7 +163,7 @@ void TaskDimRepair::updateUi()
|
||||
{
|
||||
std::string objName = m_dim->getViewPart()->getNameInDocument();
|
||||
std::string objLabel = m_dim->getViewPart()->Label.getValue();
|
||||
ui->leObject2d->setText(Base::Tools::fromStdString(objName + " / " + objLabel));
|
||||
ui->leObject2d->setText(QString::fromStdString(objName + " / " + objLabel));
|
||||
|
||||
std::vector<std::string> subElements2d;
|
||||
for (auto& ref : m_toApply2d) {
|
||||
@@ -182,15 +181,15 @@ void TaskDimRepair::loadTableWidget(QTableWidget* tw, ReferenceVector refs)
|
||||
tw->setRowCount(refs.size() + 1);
|
||||
size_t iRow = 0;
|
||||
for (auto& ref : refs) {
|
||||
QString qName = Base::Tools::fromStdString(ref.getObject()->getNameInDocument());
|
||||
QString qName = QString::fromStdString(ref.getObject()->getNameInDocument());
|
||||
QTableWidgetItem* itemName = new QTableWidgetItem(qName);
|
||||
itemName->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
tw->setItem(iRow, 0, itemName);
|
||||
QString qLabel = Base::Tools::fromStdString(std::string(ref.getObject()->Label.getValue()));
|
||||
QString qLabel = QString::fromStdString(std::string(ref.getObject()->Label.getValue()));
|
||||
QTableWidgetItem* itemLabel = new QTableWidgetItem(qLabel);
|
||||
itemLabel->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
tw->setItem(iRow, 1, itemLabel);
|
||||
QString qSubName = Base::Tools::fromStdString(ref.getSubName());
|
||||
QString qSubName = QString::fromStdString(ref.getSubName());
|
||||
QTableWidgetItem* itemSubName = new QTableWidgetItem(qSubName);
|
||||
itemSubName->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
tw->setItem(iRow, 2, itemSubName);
|
||||
@@ -209,8 +208,8 @@ void TaskDimRepair::fillList(QListWidget* lwItems, std::vector<std::string> labe
|
||||
int i = 0;
|
||||
lwItems->clear();
|
||||
for (; i < labelCount; i++) {
|
||||
qLabel = Base::Tools::fromStdString(labels[i]);
|
||||
qName = Base::Tools::fromStdString(names[i]);
|
||||
qLabel = QString::fromStdString(labels[i]);
|
||||
qName = QString::fromStdString(names[i]);
|
||||
qText = QString::fromUtf8("%1 %2").arg(qName, qLabel);
|
||||
item = new QListWidgetItem(qText, lwItems);
|
||||
item->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
@@ -234,7 +233,7 @@ bool TaskDimRepair::accept()
|
||||
{
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.ActiveDocument.resetEdit()");
|
||||
|
||||
Gui::Command::openCommand(Base::Tools::toStdString(tr("Repair Dimension")).c_str());
|
||||
Gui::Command::openCommand(tr("Repair Dimension").toStdString().c_str());
|
||||
replaceReferences();
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
#include <App/Document.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/Vector3D.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
@@ -94,7 +93,7 @@ void TaskGeomHatch::initUi()
|
||||
|
||||
void TaskGeomHatch::onFileChanged()
|
||||
{
|
||||
auto filespec = Base::Tools::toStdString(ui->fcFile->fileName());
|
||||
auto filespec = ui->fcFile->fileName().toStdString();
|
||||
m_file = DU::cleanFilespecBackslash(filespec);
|
||||
std::vector<std::string> names = PATLineSpec::getPatternList(m_file);
|
||||
QStringList qsNames = listToQ(names);
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/Vector3D.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
@@ -96,7 +95,7 @@ TaskHatch::~TaskHatch()
|
||||
void TaskHatch::setUiPrimary()
|
||||
{
|
||||
setWindowTitle(QObject::tr("Create Face Hatch"));
|
||||
ui->fcFile->setFileName(Base::Tools::fromStdString(DrawHatch::prefSvgHatch()));
|
||||
ui->fcFile->setFileName(QString::fromStdString(DrawHatch::prefSvgHatch()));
|
||||
ui->fcFile->setFilter(QString::fromUtf8(
|
||||
"SVG files (*.svg *.SVG);;Bitmap files(*.jpg *.jpeg *.png *.bmp);;All files (*)"));
|
||||
ui->sbScale->setValue(1.0);
|
||||
@@ -108,7 +107,7 @@ void TaskHatch::setUiPrimary()
|
||||
void TaskHatch::setUiEdit()
|
||||
{
|
||||
setWindowTitle(QObject::tr("Edit Face Hatch"));
|
||||
ui->fcFile->setFileName(Base::Tools::fromStdString(m_saveFile));
|
||||
ui->fcFile->setFileName(QString::fromStdString(m_saveFile));
|
||||
ui->fcFile->setFilter(QString::fromUtf8(
|
||||
"SVG files (*.svg *.SVG);;Bitmap files(*.jpg *.jpeg *.png *.bmp);;All files (*)"));
|
||||
ui->sbScale->setValue(m_saveScale);
|
||||
@@ -144,7 +143,7 @@ void TaskHatch::restoreHatchState()
|
||||
|
||||
void TaskHatch::onFileChanged()
|
||||
{
|
||||
m_file = Base::Tools::toStdString(ui->fcFile->fileName());
|
||||
m_file = ui->fcFile->fileName().toStdString();
|
||||
apply();
|
||||
}
|
||||
|
||||
@@ -209,7 +208,7 @@ void TaskHatch::createHatch()
|
||||
m_hatch = static_cast<TechDraw::DrawHatch *>(doc->getObject(FeatName.c_str()));
|
||||
m_hatch->Source.setValue(m_dvp, m_subs);
|
||||
|
||||
auto filespec = Base::Tools::toStdString(ui->fcFile->fileName());
|
||||
auto filespec = ui->fcFile->fileName().toStdString();
|
||||
filespec = DU::cleanFilespecBackslash(filespec);
|
||||
Command::doCommand(Command::Doc, "App.activeDocument().%s.HatchPattern = '%s'",
|
||||
FeatName.c_str(),
|
||||
@@ -239,7 +238,7 @@ void TaskHatch::updateHatch()
|
||||
|
||||
Command::openCommand(QT_TRANSLATE_NOOP("Command", "Update Hatch"));
|
||||
|
||||
auto filespec = Base::Tools::toStdString(ui->fcFile->fileName());
|
||||
auto filespec = ui->fcFile->fileName().toStdString();
|
||||
filespec = DU::cleanFilespecBackslash(filespec);
|
||||
Command::doCommand(Command::Doc, "App.activeDocument().%s.HatchPattern = '%s'",
|
||||
FeatName.c_str(),
|
||||
|
||||
@@ -221,7 +221,7 @@ void TaskLeaderLine::setUiPrimary()
|
||||
|
||||
if (m_baseFeat) {
|
||||
std::string baseName = m_baseFeat->getNameInDocument();
|
||||
ui->tbBaseView->setText(Base::Tools::fromStdString(baseName));
|
||||
ui->tbBaseView->setText(QString::fromStdString(baseName));
|
||||
}
|
||||
|
||||
ui->pbTracker->setText(tr("Pick points"));
|
||||
@@ -264,7 +264,7 @@ void TaskLeaderLine::setUiEdit()
|
||||
|
||||
if (m_lineFeat) {
|
||||
std::string baseName = m_lineFeat->LeaderParent.getValue()->getNameInDocument();
|
||||
ui->tbBaseView->setText(Base::Tools::fromStdString(baseName));
|
||||
ui->tbBaseView->setText(QString::fromStdString(baseName));
|
||||
|
||||
DrawGuiUtil::loadArrowBox(ui->cboxStartSym);
|
||||
ui->cboxStartSym->setCurrentIndex(m_lineFeat->StartSymbol.getValue());
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#endif // #ifndef _PreComp_
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
@@ -79,7 +78,7 @@ TaskLineDecor::~TaskLineDecor()
|
||||
void TaskLineDecor::initUi()
|
||||
{
|
||||
std::string viewName = m_partFeat->getNameInDocument();
|
||||
ui->le_View->setText(Base::Tools::fromStdString(viewName));
|
||||
ui->le_View->setText(QString::fromStdString(viewName));
|
||||
|
||||
std::stringstream ss;
|
||||
for (auto& e: m_edges) {
|
||||
@@ -90,7 +89,7 @@ void TaskLineDecor::initUi()
|
||||
if (!temp.empty()) {
|
||||
temp.resize(temp.length() - 2);
|
||||
}
|
||||
ui->le_Lines->setText(Base::Tools::fromStdString(temp));
|
||||
ui->le_Lines->setText(QString::fromStdString(temp));
|
||||
|
||||
ui->cc_Color->setColor(m_color.asValue<QColor>());
|
||||
ui->dsb_Weight->setValue(m_weight);
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include <App/Document.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
@@ -167,7 +166,7 @@ void TaskRichAnno::setUiPrimary()
|
||||
|
||||
if (m_baseFeat) {
|
||||
std::string baseName = m_baseFeat->getNameInDocument();
|
||||
ui->leBaseView->setText(Base::Tools::fromStdString(baseName));
|
||||
ui->leBaseView->setText(QString::fromStdString(baseName));
|
||||
}
|
||||
ui->dsbWidth->setUnit(Base::Unit::Length);
|
||||
ui->dsbWidth->setMinimum(0);
|
||||
@@ -210,7 +209,7 @@ void TaskRichAnno::setUiEdit()
|
||||
if (docObj) {
|
||||
baseName = docObj->getNameInDocument();
|
||||
}
|
||||
ui->leBaseView->setText(Base::Tools::fromStdString(baseName));
|
||||
ui->leBaseView->setText(QString::fromStdString(baseName));
|
||||
ui->teAnnoText->setHtml(QString::fromUtf8(m_annoFeat->AnnoText.getValue()));
|
||||
ui->dsbMaxWidth->setValue(m_annoFeat->MaxWidth.getValue());
|
||||
ui->cbShowFrame->setChecked(m_annoFeat->ShowFrame.getValue());
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Control.h>
|
||||
@@ -159,7 +158,7 @@ void TaskSectionView::setUiEdit()
|
||||
// Base::Console().Message("TSV::setUiEdit()\n");
|
||||
setWindowTitle(QObject::tr("Edit Section View"));
|
||||
std::string temp = m_section->SectionSymbol.getValue();
|
||||
QString qTemp = Base::Tools::fromStdString(temp);
|
||||
QString qTemp = QString::fromStdString(temp);
|
||||
ui->leSymbol->setText(qTemp);
|
||||
|
||||
ui->sbScale->setValue(m_section->getScale());
|
||||
@@ -188,7 +187,7 @@ void TaskSectionView::setUiEdit()
|
||||
void TaskSectionView::setUiCommon(Base::Vector3d origin)
|
||||
{
|
||||
std::string temp = m_base->getNameInDocument();
|
||||
QString qTemp = Base::Tools::fromStdString(temp);
|
||||
QString qTemp = QString::fromStdString(temp);
|
||||
ui->leBaseView->setText(qTemp);
|
||||
|
||||
ui->sbOrgX->setUnit(Base::Unit::Length);
|
||||
@@ -441,7 +440,7 @@ bool TaskSectionView::apply(bool forceUpdate)
|
||||
if (m_dirName.empty()) {
|
||||
//this should never happen
|
||||
std::string msg =
|
||||
Base::Tools::toStdString(tr("Nothing to apply. No section direction picked yet"));
|
||||
tr("Nothing to apply. No section direction picked yet").toStdString();
|
||||
Base::Console().Error((msg + "\n").c_str());
|
||||
return false;
|
||||
}
|
||||
@@ -512,7 +511,7 @@ TechDraw::DrawViewSection* TaskSectionView::createSectionView(void)
|
||||
// we pluck the generated suffix from the object name and append it to "Section" to generate
|
||||
// unique Labels
|
||||
QString qTemp = ui->leSymbol->text();
|
||||
std::string temp = Base::Tools::toStdString(qTemp);
|
||||
std::string temp = qTemp.toStdString();
|
||||
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.SectionSymbol = '%s'",
|
||||
m_sectionName.c_str(), temp.c_str());
|
||||
|
||||
@@ -592,7 +591,7 @@ void TaskSectionView::updateSectionView()
|
||||
ui->sbOrgY->value().getValue(), ui->sbOrgZ->value().getValue());
|
||||
|
||||
QString qTemp = ui->leSymbol->text();
|
||||
std::string temp = Base::Tools::toStdString(qTemp);
|
||||
std::string temp = qTemp.toStdString();
|
||||
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.SectionSymbol = '%s'",
|
||||
m_sectionName.c_str(), temp.c_str());
|
||||
|
||||
@@ -635,14 +634,14 @@ std::string TaskSectionView::makeSectionLabel(QString symbol)
|
||||
const std::string objectName("SectionView");
|
||||
std::string uniqueSuffix{m_sectionName.substr(objectName.length(), std::string::npos)};
|
||||
std::string uniqueLabel = "Section" + uniqueSuffix;
|
||||
std::string temp = Base::Tools::toStdString(symbol);
|
||||
std::string temp = symbol.toStdString();
|
||||
return ( uniqueLabel + " " + temp + " - " + temp );
|
||||
}
|
||||
|
||||
void TaskSectionView::failNoObject(void)
|
||||
{
|
||||
QString qsectionName = Base::Tools::fromStdString(m_sectionName);
|
||||
QString qbaseName = Base::Tools::fromStdString(m_baseName);
|
||||
QString qsectionName = QString::fromStdString(m_sectionName);
|
||||
QString qbaseName = QString::fromStdString(m_baseName);
|
||||
QString msg = tr("Can not continue. Object * %1 or %2 not found.").arg(qsectionName, qbaseName);
|
||||
QMessageBox::critical(Gui::getMainWindow(), QObject::tr("Operation Failed"), msg);
|
||||
Gui::Control().closeDialog();
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#endif // #ifndef _PreCmp_
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawTemplate.h>
|
||||
#include <Mod/TechDraw/App/DrawSVGTemplate.h>
|
||||
@@ -78,7 +77,7 @@ void TemplateTextField::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
|
||||
ui.setFieldName(fieldNameStr);
|
||||
ui.setFieldContent(tmplte->EditableTexts[fieldNameStr]);
|
||||
ui.setAutofillContent(Base::Tools::toStdString(m_autofillString));
|
||||
ui.setAutofillContent(m_autofillString.toStdString());
|
||||
|
||||
if (ui.exec() == QDialog::Accepted) {
|
||||
QString qsClean = ui.getFieldContent();
|
||||
@@ -86,7 +85,7 @@ void TemplateTextField::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
if (ui.getAutofillState()) {
|
||||
auto svgTemplate = dynamic_cast<DrawSVGTemplate*>(tmplte);
|
||||
if (svgTemplate) {
|
||||
QString fieldName = Base::Tools::fromStdString(fieldNameStr);
|
||||
QString fieldName = QString::fromStdString(fieldNameStr);
|
||||
QString autofillValue = svgTemplate->getAutofillByEditableName(fieldName);
|
||||
if (!autofillValue.isEmpty()) {
|
||||
utf8Content = autofillValue.toUtf8().constData();
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Control.h>
|
||||
#include <Gui/Document.h>
|
||||
@@ -364,8 +363,8 @@ void ViewProviderDrawingView::onProgressMessage(const TechDraw::DrawView* dv,
|
||||
void ViewProviderDrawingView::showProgressMessage(const std::string featureName, const std::string text) const
|
||||
{
|
||||
QString msg = QString::fromUtf8("%1 %2")
|
||||
.arg(Base::Tools::fromStdString(featureName),
|
||||
Base::Tools::fromStdString(text));
|
||||
.arg(QString::fromStdString(featureName),
|
||||
QString::fromStdString(text));
|
||||
if (Gui::getMainWindow()) {
|
||||
//neither of these work! Base::Console().Message() output preempts these messages??
|
||||
// Gui::getMainWindow()->showMessage(msg, 3000);
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <Mod/TechDraw/TechDrawGlobal.h>
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include "CompassDialWidget.h"
|
||||
|
||||
@@ -151,7 +150,7 @@ void CompassDialWidget::drawMarkings(QPainter& painter)
|
||||
if (iDegree % 45 == 0) {
|
||||
//Named direction (every 45°)
|
||||
painter.drawLine(0, -40, 0, -50); //this has to depend on m_rect or size?
|
||||
QString qPointText = Base::Tools::fromStdString(CompassPointText.at(iDegree));
|
||||
QString qPointText = QString::fromStdString(CompassPointText.at(iDegree));
|
||||
painter.drawText(-metrics.boundingRect(qPointText).width() / 2.0, -52, qPointText);
|
||||
// what is -52? line end point y = -50 + 2 for margin?
|
||||
} else {
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
#include <limits>
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/UnitsApi.h>
|
||||
|
||||
#include <Gui/SpinBox.h>
|
||||
@@ -96,7 +95,7 @@ bool VectorEditWidget::eventFilter(QObject *target, QEvent *event)
|
||||
}
|
||||
void VectorEditWidget::setLabel(std::string newLabel)
|
||||
{
|
||||
QString qNewLabelString = Base::Tools::fromStdString(newLabel);
|
||||
QString qNewLabelString = QString::fromStdString(newLabel);
|
||||
lvectorName->setText(qNewLabelString);
|
||||
}
|
||||
|
||||
@@ -178,7 +177,7 @@ void VectorEditWidget::slotZValueChanged(double newValue)
|
||||
void VectorEditWidget::updateDisplay()
|
||||
{
|
||||
// Base::Console().Message("VEW::updateDisplay() - m_value: %s\n", DrawUtil::formatVector(m_value).c_str());
|
||||
QString qNewDisplayString = Base::Tools::fromStdString(DrawUtil::formatVector(m_value));
|
||||
QString qNewDisplayString = QString::fromStdString(DrawUtil::formatVector(m_value));
|
||||
leVectorDisplay->setText(qNewDisplayString);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/FileDialog.h>
|
||||
#include <Mod/TechDraw/App/Preferences.h>
|
||||
|
||||
@@ -812,7 +811,7 @@ void MRichTextEdit::setDefFont(QString fontName)
|
||||
|
||||
QFont MRichTextEdit::getDefFont()
|
||||
{
|
||||
QString family = Base::Tools::fromStdString(Preferences::labelFont());
|
||||
QString family = QString::fromStdString(Preferences::labelFont());
|
||||
m_defFont = family;
|
||||
QFont result;
|
||||
result.setFamily(family);
|
||||
|
||||
Reference in New Issue
Block a user