Spreadsheet: Use Base::fromStdString/toStdString.
This commit is contained in:
parent
bee11897a1
commit
4f589f6d60
|
@ -37,6 +37,7 @@
|
|||
#include <Base/Placement.h>
|
||||
#include <Base/Reader.h>
|
||||
#include <Base/Writer.h>
|
||||
#include <Base/Tools.h>
|
||||
#include "SpreadsheetExpression.h"
|
||||
#include "Sheet.h"
|
||||
#include "SheetObserver.h"
|
||||
|
@ -670,7 +671,7 @@ void Sheet::recomputeCell(CellAddress p)
|
|||
catch (const Base::Exception & e) {
|
||||
QString msg = QString::fromUtf8("ERR: %1").arg(QString::fromUtf8(e.what()));
|
||||
|
||||
setStringProperty(p, msg.toStdString());
|
||||
setStringProperty(p, Base::Tools::toStdString(msg));
|
||||
if (cell)
|
||||
cell->setException(e.what());
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Interpreter.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <App/Document.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
|
@ -183,7 +184,7 @@ void CmdSpreadsheetImport::activated(int iMsg)
|
|||
std::string FeatName = getUniqueObjectName("Spreadsheet");
|
||||
Sheet * sheet = freecad_dynamic_cast<Sheet>(App::GetApplication().getActiveDocument()->addObject("Spreadsheet::Sheet", FeatName.c_str()));
|
||||
|
||||
sheet->importFromFile(fileName.toStdString(), '\t', '"', '\\');
|
||||
sheet->importFromFile(Base::Tools::toStdString(fileName), '\t', '"', '\\');
|
||||
sheet->execute();
|
||||
}
|
||||
}
|
||||
|
@ -225,7 +226,7 @@ void CmdSpreadsheetExport::activated(int iMsg)
|
|||
formatList,
|
||||
&selectedFilter);
|
||||
if (!fileName.isEmpty())
|
||||
sheet->exportToFile(fileName.toStdString(), '\t', '"', '\\');
|
||||
sheet->exportToFile(Base::Tools::toStdString(fileName), '\t', '"', '\\');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,9 +90,9 @@ PropertiesDialog::PropertiesDialog(Sheet *_sheet, const std::vector<Range> &_ran
|
|||
if (style.find("underline") != style.end())
|
||||
ui->styleUnderline->setChecked(true);
|
||||
|
||||
ui->displayUnit->setText(QString::fromStdString(displayUnit.stringRep));
|
||||
ui->displayUnit->setText(Base::Tools::fromStdString(displayUnit.stringRep));
|
||||
|
||||
ui->alias->setText(QString::fromStdString(alias));
|
||||
ui->alias->setText(Base::Tools::fromStdString(alias));
|
||||
|
||||
// Colors
|
||||
connect(ui->foregroundColor, SIGNAL(colorChanged(QColor)), this, SLOT(foregroundColorChanged(QColor)));
|
||||
|
@ -212,7 +212,7 @@ void PropertiesDialog::aliasChanged(const QString & text)
|
|||
catch (...) {
|
||||
aliasOk = true;
|
||||
palette.setColor(QPalette::Text, Qt::black);
|
||||
alias = text.toStdString();
|
||||
alias = Base::Tools::toStdString(text);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <Mod/Spreadsheet/App/Utils.h>
|
||||
#include "../App/Sheet.h"
|
||||
#include <Gui/Command.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <strstream>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
|
@ -155,13 +156,13 @@ QVariant SheetModel::data(const QModelIndex &index, int role) const
|
|||
if (deps.size() > 0) {
|
||||
v += QString::fromUtf8("Depends on:");
|
||||
for (std::set<std::string>::const_iterator i = deps.begin(); i != deps.end(); ++i)
|
||||
v += QString::fromUtf8("\n\t") + QString::fromStdString(*i);
|
||||
v += QString::fromUtf8("\n\t") + Tools::fromStdString(*i);
|
||||
v += QString::fromUtf8("\n");
|
||||
}
|
||||
if (provides.size() > 0) {
|
||||
v += QString::fromUtf8("Used by:");
|
||||
for (std::set<std::string>::const_iterator i = provides.begin(); i != provides.end(); ++i)
|
||||
v += QString::fromUtf8("\n\t") + QString::fromStdString(*i);
|
||||
v += QString::fromUtf8("\n\t") + Tools::fromStdString(*i);
|
||||
v += QString::fromUtf8("\n");
|
||||
}
|
||||
return QVariant(v);
|
||||
|
@ -171,10 +172,10 @@ QVariant SheetModel::data(const QModelIndex &index, int role) const
|
|||
if (cell->hasException()) {
|
||||
switch (role) {
|
||||
case Qt::ToolTipRole:
|
||||
return QVariant::fromValue(QString::fromStdString(cell->getException()));
|
||||
return QVariant::fromValue(Base::Tools::fromStdString(cell->getException()));
|
||||
case Qt::DisplayRole:
|
||||
#ifdef DEBUG_DEPS
|
||||
return QVariant::fromValue(QString::fromUtf8("#ERR: %1").arg(QString::fromStdString(cell->getException())));
|
||||
return QVariant::fromValue(QString::fromUtf8("#ERR: %1").arg(Tools::fromStdString(cell->getException())));
|
||||
#else
|
||||
return QVariant::fromValue(QString::fromUtf8("#ERR"));
|
||||
#endif
|
||||
|
@ -303,13 +304,13 @@ QVariant SheetModel::data(const QModelIndex &index, int role) const
|
|||
|
||||
if (cell->getDisplayUnit(displayUnit)) {
|
||||
if (computedUnit.isEmpty() || computedUnit == displayUnit.unit)
|
||||
v = QString::number(floatProp->getValue() / displayUnit.scaler) + QString::fromStdString(" " + displayUnit.stringRep);
|
||||
v = QString::number(floatProp->getValue() / displayUnit.scaler) + Base::Tools::fromStdString(" " + displayUnit.stringRep);
|
||||
else
|
||||
v = QString::fromUtf8("ERR: unit");
|
||||
}
|
||||
else {
|
||||
if (!computedUnit.isEmpty())
|
||||
v = QString::number(floatProp->getValue()) + QString::fromStdString(" " + getUnitString(computedUnit));
|
||||
v = QString::number(floatProp->getValue()) + Base::Tools::fromStdString(" " + getUnitString(computedUnit));
|
||||
else
|
||||
v = QString::number(floatProp->getValue());
|
||||
}
|
||||
|
@ -346,7 +347,7 @@ QVariant SheetModel::data(const QModelIndex &index, int role) const
|
|||
DisplayUnit displayUnit;
|
||||
|
||||
if (cell->getDisplayUnit(displayUnit))
|
||||
v = QString::number(floatProp->getValue() / displayUnit.scaler) + QString::fromStdString(" " + displayUnit.stringRep);
|
||||
v = QString::number(floatProp->getValue() / displayUnit.scaler) + Base::Tools::fromStdString(" " + displayUnit.stringRep);
|
||||
else
|
||||
v = QString::number(floatProp->getValue());
|
||||
return QVariant(v);
|
||||
|
@ -403,7 +404,7 @@ bool SheetModel::setData(const QModelIndex & index, const QVariant & value, int
|
|||
if (cell)
|
||||
cell->getStringContent(content);
|
||||
|
||||
if ( content != str.toStdString()) {
|
||||
if ( content != Base::Tools::toStdString(str)) {
|
||||
str.replace(QString::fromUtf8("'"), QString::fromUtf8("\\'"));
|
||||
Gui::Command::openCommand("Edit cell");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.set('%s', '%s')", sheet->getNameInDocument(),
|
||||
|
|
Loading…
Reference in New Issue
Block a user