Sketcher: Use QStringLiteral

This commit is contained in:
Benjamin Bræstrup Sayoc
2025-02-10 18:32:45 +01:00
parent bada65edc3
commit c0c6df10ec
40 changed files with 275 additions and 305 deletions
+9 -9
View File
@@ -101,15 +101,15 @@ PyMOD_INIT_FUNC(SketcherGui)
PyObject* sketcherGuiModule = SketcherGui::initModule();
Base::Console().Log("Loading GUI of Sketcher module... done\n");
Gui::BitmapFactory().addPath(QString::fromLatin1(":/icons/constraints"));
Gui::BitmapFactory().addPath(QString::fromLatin1(":/icons/elements"));
Gui::BitmapFactory().addPath(QString::fromLatin1(":/icons/general"));
Gui::BitmapFactory().addPath(QString::fromLatin1(":/icons/geometry"));
// Gui::BitmapFactory().addPath(QString::fromLatin1(":/icons/obsolete"));
Gui::BitmapFactory().addPath(QString::fromLatin1(":/icons/pointers"));
Gui::BitmapFactory().addPath(QString::fromLatin1(":/icons/splines"));
Gui::BitmapFactory().addPath(QString::fromLatin1(":/icons/tools"));
Gui::BitmapFactory().addPath(QString::fromLatin1(":/icons/overlay"));
Gui::BitmapFactory().addPath(QStringLiteral(":/icons/constraints"));
Gui::BitmapFactory().addPath(QStringLiteral(":/icons/elements"));
Gui::BitmapFactory().addPath(QStringLiteral(":/icons/general"));
Gui::BitmapFactory().addPath(QStringLiteral(":/icons/geometry"));
// Gui::BitmapFactory().addPath(QStringLiteral(":/icons/obsolete"));
Gui::BitmapFactory().addPath(QStringLiteral(":/icons/pointers"));
Gui::BitmapFactory().addPath(QStringLiteral(":/icons/splines"));
Gui::BitmapFactory().addPath(QStringLiteral(":/icons/tools"));
Gui::BitmapFactory().addPath(QStringLiteral(":/icons/overlay"));
// instantiating the commands
CreateSketcherCommands();
+2 -2
View File
@@ -5860,7 +5860,7 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg)
/*disambig.:*/ "perpendicular constraint");
QString strError =
QObject::tr("Select some geometry from the sketch.", "perpendicular constraint");
strError.append(QString::fromLatin1("\n\n"));
strError.append(QStringLiteral("\n\n"));
strError.append(strBasicHelp);
Gui::TranslatedUserWarning(getActiveGuiDocument(),
QObject::tr("Wrong selection"),
@@ -6696,7 +6696,7 @@ void CmdSketcherConstrainTangent::activated(int iMsg)
/*disambig.:*/ "tangent constraint");
QString strError =
QObject::tr("Select some geometry from the sketch.", "tangent constraint");
strError.append(QString::fromLatin1("\n\n"));
strError.append(QStringLiteral("\n\n"));
strError.append(strBasicHelp);
Gui::TranslatedUserWarning(getActiveGuiDocument(),
QObject::tr("Wrong selection"),
@@ -870,7 +870,7 @@ public:
private:
QString getCrosshairCursorSVGName() const override
{
return QString::fromLatin1("Sketcher_Pointer_InsertKnot");
return QStringLiteral("Sketcher_Pointer_InsertKnot");
}
protected:
@@ -1635,7 +1635,7 @@ void CmdSketcherCompCopy::activated(int iMsg)
else if (iMsg == 2) {
CmdSketcherMove sc;
sc.activate();
pcAction->setShortcut(QString::fromLatin1(""));
pcAction->setShortcut(QStringLiteral(""));
}
}
+6 -6
View File
@@ -385,22 +385,22 @@ DrawSketchHandler::suggestedConstraintsPixmaps(std::vector<AutoConstraint>& sugg
QString iconType;
switch (autoCstr.Type) {
case Horizontal:
iconType = QString::fromLatin1("Constraint_Horizontal");
iconType = QStringLiteral("Constraint_Horizontal");
break;
case Vertical:
iconType = QString::fromLatin1("Constraint_Vertical");
iconType = QStringLiteral("Constraint_Vertical");
break;
case Coincident:
iconType = QString::fromLatin1("Constraint_PointOnPoint");
iconType = QStringLiteral("Constraint_PointOnPoint");
break;
case PointOnObject:
iconType = QString::fromLatin1("Constraint_PointOnObject");
iconType = QStringLiteral("Constraint_PointOnObject");
break;
case Symmetric:
iconType = QString::fromLatin1("Constraint_Symmetric");
iconType = QStringLiteral("Constraint_Symmetric");
break;
case Tangent:
iconType = QString::fromLatin1("Constraint_Tangent");
iconType = QStringLiteral("Constraint_Tangent");
break;
default:
break;
+2 -2
View File
@@ -310,10 +310,10 @@ private:
QString getCrosshairCursorSVGName() const override
{
if (constructionMethod() == DrawSketchHandlerArc::ConstructionMethod::Center) {
return QString::fromLatin1("Sketcher_Pointer_Create_Arc");
return QStringLiteral("Sketcher_Pointer_Create_Arc");
}
else { // constructionMethod == DrawSketchHandlerArc::ConstructionMethod::ThreeRim
return QString::fromLatin1("Sketcher_Pointer_Create_3PointArc");
return QStringLiteral("Sketcher_Pointer_Create_3PointArc");
}
return QStringLiteral("None");
@@ -383,7 +383,7 @@ public:
private:
QString getCrosshairCursorSVGName() const override
{
return QString::fromLatin1("Sketcher_Pointer_Create_ArcOfEllipse");
return QStringLiteral("Sketcher_Pointer_Create_ArcOfEllipse");
}
protected:
@@ -397,7 +397,7 @@ public:
private:
QString getCrosshairCursorSVGName() const override
{
return QString::fromLatin1("Sketcher_Pointer_Create_ArcOfHyperbola");
return QStringLiteral("Sketcher_Pointer_Create_ArcOfHyperbola");
}
@@ -319,7 +319,7 @@ public:
private:
QString getCrosshairCursorSVGName() const override
{
return QString::fromLatin1("Sketcher_Pointer_Create_ArcOfParabola");
return QStringLiteral("Sketcher_Pointer_Create_ArcOfParabola");
}
protected:
@@ -242,10 +242,10 @@ private:
QString getCrosshairCursorSVGName() const override
{
if (constructionMethod() == DrawSketchHandlerArcSlot::ConstructionMethod::ArcSlot) {
return QString::fromLatin1("Sketcher_Pointer_Create_ArcSlot");
return QStringLiteral("Sketcher_Pointer_Create_ArcSlot");
}
else {
return QString::fromLatin1("Sketcher_Pointer_Create_RectangleSlot");
return QStringLiteral("Sketcher_Pointer_Create_RectangleSlot");
}
}
+10 -12
View File
@@ -251,13 +251,12 @@ private:
Gui::Command::runCommand(Gui::Command::Gui, "_bsps = []");
for (auto& controlpoints : controlpointses) {
// TODO: variable degrees?
QString cmdstr =
QString::fromLatin1("_bsps.append(Part.BSplineCurve())\n"
"_bsps[-1].interpolate(%1, PeriodicFlag=%2)\n"
"_bsps[-1].increaseDegree(%3)")
.arg(QString::fromLatin1(controlpoints.c_str()))
.arg(QString::fromLatin1(periodic ? "True" : "False"))
.arg(myDegree);
QString cmdstr = QStringLiteral("_bsps.append(Part.BSplineCurve())\n"
"_bsps[-1].interpolate(%1, PeriodicFlag=%2)\n"
"_bsps[-1].increaseDegree(%3)")
.arg(QString::fromLatin1(controlpoints.c_str()))
.arg(QString::fromLatin1(periodic ? "True" : "False"))
.arg(myDegree);
Gui::Command::runCommand(Gui::Command::Gui, cmdstr.toLatin1());
// Adjust internal knots here (raise multiplicity)
// How this contributes to the final B-spline
@@ -414,19 +413,18 @@ private:
{
if (constructionMethod() == ConstructionMethod::ControlPoints) {
if (periodic) {
return QString::fromLatin1("Sketcher_Pointer_Create_Periodic_BSpline");
return QStringLiteral("Sketcher_Pointer_Create_Periodic_BSpline");
}
else {
return QString::fromLatin1("Sketcher_Pointer_Create_BSpline");
return QStringLiteral("Sketcher_Pointer_Create_BSpline");
}
}
else {
if (periodic) {
return QString::fromLatin1(
"Sketcher_Pointer_Create_Periodic_BSplineByInterpolation");
return QStringLiteral("Sketcher_Pointer_Create_Periodic_BSplineByInterpolation");
}
else {
return QString::fromLatin1("Sketcher_Pointer_Create_BSplineByInterpolation");
return QStringLiteral("Sketcher_Pointer_Create_BSplineByInterpolation");
}
}
}
@@ -210,7 +210,7 @@ private:
QString getCrosshairCursorSVGName() const override
{
return QString::fromLatin1("Sketcher_Pointer_CarbonCopy");
return QStringLiteral("Sketcher_Pointer_CarbonCopy");
}
void deactivated() override
@@ -236,10 +236,10 @@ private:
QString getCrosshairCursorSVGName() const override
{
if (constructionMethod() == DrawSketchHandlerCircle::ConstructionMethod::Center) {
return QString::fromLatin1("Sketcher_Pointer_Create_Circle");
return QStringLiteral("Sketcher_Pointer_Create_Circle");
}
else {
return QString::fromLatin1("Sketcher_Pointer_Create_3PointCircle");
return QStringLiteral("Sketcher_Pointer_Create_3PointCircle");
}
}
@@ -249,10 +249,10 @@ private:
QString getCrosshairCursorSVGName() const override
{
if (constructionMethod() == DrawSketchHandlerEllipse::ConstructionMethod::Center) {
return QString::fromLatin1("Sketcher_Pointer_Create_EllipseByCenter");
return QStringLiteral("Sketcher_Pointer_Create_EllipseByCenter");
}
else {
return QString::fromLatin1("Sketcher_Pointer_Create_Ellipse_3points");
return QStringLiteral("Sketcher_Pointer_Create_Ellipse_3points");
}
}
@@ -355,7 +355,7 @@ private:
QString getCrosshairCursorSVGName() const override
{
return QString::fromLatin1("Sketcher_Pointer_Extension");
return QStringLiteral("Sketcher_Pointer_Extension");
}
protected:
@@ -219,10 +219,10 @@ private:
QString getCrosshairCursorSVGName() const override
{
if (intersection) {
return QString::fromLatin1("Sketcher_Pointer_External_Intersection");
return QStringLiteral("Sketcher_Pointer_External_Intersection");
}
return QString::fromLatin1("Sketcher_Pointer_External");
return QStringLiteral("Sketcher_Pointer_External");
}
void deactivated() override
@@ -314,18 +314,18 @@ private:
if (constructionMethod() == DrawSketchHandlerFillet::ConstructionMethod::Fillet) {
if (preserveCorner) {
return QString::fromLatin1("Sketcher_Pointer_Create_PointFillet");
return QStringLiteral("Sketcher_Pointer_Create_PointFillet");
}
else {
return QString::fromLatin1("Sketcher_Pointer_Create_Fillet");
return QStringLiteral("Sketcher_Pointer_Create_Fillet");
}
}
else {
if (preserveCorner) {
return QString::fromLatin1("Sketcher_Pointer_Create_PointChamfer");
return QStringLiteral("Sketcher_Pointer_Create_PointChamfer");
}
else {
return QString::fromLatin1("Sketcher_Pointer_Create_Chamfer");
return QStringLiteral("Sketcher_Pointer_Create_Chamfer");
}
}
}
+2 -2
View File
@@ -183,10 +183,10 @@ private:
QString getCrosshairCursorSVGName() const override
{
if (constructionMethod() == ConstructionMethod::OnePointLengthAngle) {
return QString::fromLatin1("Sketcher_Pointer_Create_Line_Polar");
return QStringLiteral("Sketcher_Pointer_Create_Line_Polar");
}
else {
return QString::fromLatin1("Sketcher_Pointer_Create_Line.svg");
return QStringLiteral("Sketcher_Pointer_Create_Line.svg");
}
}
@@ -751,7 +751,7 @@ public:
private:
QString getCrosshairCursorSVGName() const override
{
return QString::fromLatin1("Sketcher_Pointer_Create_Lineset");
return QStringLiteral("Sketcher_Pointer_Create_Lineset");
}
protected:
@@ -157,7 +157,7 @@ private:
QString getCrosshairCursorSVGName() const override
{
return QString::fromLatin1("Sketcher_Pointer_Create_Offset");
return QStringLiteral("Sketcher_Pointer_Create_Offset");
}
std::unique_ptr<QWidget> createWidget() const override
@@ -115,7 +115,7 @@ private:
QString getCrosshairCursorSVGName() const override
{
return QString::fromLatin1("Sketcher_Pointer_Create_Point");
return QStringLiteral("Sketcher_Pointer_Create_Point");
}
std::unique_ptr<QWidget> createWidget() const override
@@ -179,7 +179,7 @@ private:
QString getCrosshairCursorSVGName() const override
{
return QString::fromLatin1("Sketcher_Pointer_Regular_Polygon");
return QStringLiteral("Sketcher_Pointer_Regular_Polygon");
}
std::unique_ptr<QWidget> createWidget() const override
@@ -529,40 +529,40 @@ private:
{
if (!roundCorners && !makeFrame) {
if (constructionMethod() == ConstructionMethod::CenterAndCorner) {
return QString::fromLatin1("Sketcher_Pointer_Create_Box_Center");
return QStringLiteral("Sketcher_Pointer_Create_Box_Center");
}
else if (constructionMethod() == ConstructionMethod::ThreePoints) {
return QString::fromLatin1("Sketcher_Pointer_Create_Box_3Points");
return QStringLiteral("Sketcher_Pointer_Create_Box_3Points");
}
else if (constructionMethod() == ConstructionMethod::CenterAnd3Points) {
return QString::fromLatin1("Sketcher_Pointer_Create_Box_3Points_Center");
return QStringLiteral("Sketcher_Pointer_Create_Box_3Points_Center");
}
else {
return QString::fromLatin1("Sketcher_Pointer_Create_Box");
return QStringLiteral("Sketcher_Pointer_Create_Box");
}
}
else if (roundCorners && !makeFrame) {
if (constructionMethod() == ConstructionMethod::CenterAndCorner) {
return QString::fromLatin1("Sketcher_Pointer_Oblong_Center");
return QStringLiteral("Sketcher_Pointer_Oblong_Center");
}
else {
return QString::fromLatin1("Sketcher_Pointer_Oblong");
return QStringLiteral("Sketcher_Pointer_Oblong");
}
}
else if (!roundCorners && makeFrame) {
if (constructionMethod() == ConstructionMethod::CenterAndCorner) {
return QString::fromLatin1("Sketcher_Pointer_Create_Frame_Center");
return QStringLiteral("Sketcher_Pointer_Create_Frame_Center");
}
else {
return QString::fromLatin1("Sketcher_Pointer_Create_Frame");
return QStringLiteral("Sketcher_Pointer_Create_Frame");
}
}
else { // both roundCorners and makeFrame
if (constructionMethod() == ConstructionMethod::CenterAndCorner) {
return QString::fromLatin1("Sketcher_Pointer_Oblong_Frame_Center");
return QStringLiteral("Sketcher_Pointer_Oblong_Frame_Center");
}
else {
return QString::fromLatin1("Sketcher_Pointer_Oblong_Frame");
return QStringLiteral("Sketcher_Pointer_Oblong_Frame");
}
}
}
@@ -155,7 +155,7 @@ private:
QString getCrosshairCursorSVGName() const override
{
return QString::fromLatin1("Sketcher_Pointer_Create_Rotate");
return QStringLiteral("Sketcher_Pointer_Create_Rotate");
}
std::unique_ptr<QWidget> createWidget() const override
@@ -500,13 +500,13 @@ void DSHRotateController::configureToolWidget()
QApplication::translate("TaskSketcherTool_c1_offset", "Apply equal constraints"));
toolWidget->setCheckboxToolTip(
WCheckbox::FirstBox,
QString::fromLatin1("<p>")
QStringLiteral("<p>")
+ QApplication::translate("TaskSketcherTool_c1_offset",
"If this option is selected dimensional constraints are "
"excluded from the operation.\n"
"Instead equal constraints are applied between the "
"original objects and their copies.")
+ QString::fromLatin1("</p>"));
+ QStringLiteral("</p>"));
}
onViewParameters[OnViewParameter::First]->setLabelType(Gui::SoDatumLabel::DISTANCEX);
@@ -151,7 +151,7 @@ private:
QString getCrosshairCursorSVGName() const override
{
return QString::fromLatin1("Sketcher_Pointer_Create_Scale");
return QStringLiteral("Sketcher_Pointer_Create_Scale");
}
std::unique_ptr<QWidget> createWidget() const override
+1 -1
View File
@@ -204,7 +204,7 @@ private:
QString getCrosshairCursorSVGName() const override
{
return QString::fromLatin1("Sketcher_Pointer_Slot");
return QStringLiteral("Sketcher_Pointer_Slot");
}
std::unique_ptr<QWidget> createWidget() const override
@@ -185,7 +185,7 @@ private:
QString getCrosshairCursorSVGName() const override
{
return QString::fromLatin1("Sketcher_Pointer_Splitting");
return QStringLiteral("Sketcher_Pointer_Splitting");
}
};
@@ -171,7 +171,7 @@ private:
QString getCrosshairCursorSVGName() const override
{
return QString::fromLatin1("Sketcher_Pointer_Create_Symmetry");
return QStringLiteral("Sketcher_Pointer_Create_Symmetry");
}
std::unique_ptr<QWidget> createWidget() const override
@@ -150,7 +150,7 @@ private:
QString getCrosshairCursorSVGName() const override
{
return QString::fromLatin1("Sketcher_Pointer_Create_Translate");
return QStringLiteral("Sketcher_Pointer_Create_Translate");
}
std::unique_ptr<QWidget> createWidget() const override
@@ -197,7 +197,7 @@ private:
QString getCrosshairCursorSVGName() const override
{
return QString::fromLatin1("Sketcher_Pointer_Trimming");
return QStringLiteral("Sketcher_Pointer_Trimming");
}
private:
@@ -2103,7 +2103,7 @@ QString EditModeConstraintCoinManager::getPresentationString(const Constraint* c
Base::UnitSystem unitSys; // current unit system
if (!constraint->isActive) {
return QString::fromLatin1(" ");
return QStringLiteral(" ");
}
// Get the current name parameter string of the constraint
@@ -2152,8 +2152,8 @@ QString EditModeConstraintCoinManager::getPresentationString(const Constraint* c
if (baseUnitStr.compare(unitStr) == 0) {
// Example code from: Mod/TechDraw/App/DrawViewDimension.cpp:372
QRegularExpression rxUnits(
QString::fromUtf8(" \\D*$")); // space + any non digits at end of string
valueStr.remove(rxUnits); // getUserString(defaultDecimals) without units
QStringLiteral(" \\D*$")); // space + any non digits at end of string
valueStr.remove(rxUnits); // getUserString(defaultDecimals) without units
}
}
}
@@ -2182,8 +2182,7 @@ QString EditModeConstraintCoinManager::getPresentationString(const Constraint* c
else {
// user defined format string does not contain any valid parameter, using default format
// "%N = %V"
presentationStr =
QString::fromStdString(nameStr) + QString::fromLatin1(" = ") + valueStr;
presentationStr = QString::fromStdString(nameStr) + QStringLiteral(" = ") + valueStr;
}
return presentationStr;
@@ -2333,7 +2332,7 @@ std::set<int> EditModeConstraintCoinManager::detectPreselectionConstr(const SoPi
}
else {
// It's a constraint icon, not a combined one
QStringList constrIdStrings = constrIdsStr.split(QString::fromLatin1(","));
QStringList constrIdStrings = constrIdsStr.split(QStringLiteral(","));
while (!constrIdStrings.empty()) {
auto constraintid = constrIdStrings.takeAt(0).toInt();
constrIndices.insert(constraintid);
@@ -2552,7 +2551,7 @@ void EditModeConstraintCoinManager::combineConstraintIcons(IconQueue iconQueue)
// we group only icons not being Symmetry icons, because we want those on the line
// and only icons that are visible
if (init.type != QString::fromLatin1("Constraint_Symmetric") && init.visible) {
if (init.type != QStringLiteral("Constraint_Symmetric") && init.visible) {
IconQueue::iterator i = iconQueue.begin();
@@ -2565,7 +2564,7 @@ void EditModeConstraintCoinManager::combineConstraintIcons(IconQueue iconQueue)
float distSquared = pow(i->position[0] - j->position[0], 2)
+ pow(i->position[1] - j->position[1], 2);
if (distSquared <= maxDistSquared
&& (*i).type != QString::fromLatin1("Constraint_Symmetric")) {
&& (*i).type != QStringLiteral("Constraint_Symmetric")) {
// Found an icon in iconQueue that's close enough to
// a member of thisGroup, so move it into thisGroup
thisGroup.push_back(*i);
@@ -2646,7 +2645,7 @@ void EditModeConstraintCoinManager::drawMergedConstraintIcons(IconQueue iconQueu
maxColorPriority = constrColorPriority(i->constraintId);
if (idString.length()) {
idString.append(QString::fromLatin1(","));
idString.append(QStringLiteral(","));
}
idString.append(QString::number(i->constraintId));
@@ -2666,7 +2665,7 @@ void EditModeConstraintCoinManager::drawMergedConstraintIcons(IconQueue iconQueu
iconColor = constrColor(i->constraintId);
}
idString.append(QString::fromLatin1(",") + QString::number(i->constraintId));
idString.append(QStringLiteral(",") + QString::number(i->constraintId));
i = iconQueue.erase(i);
}
@@ -2758,7 +2757,7 @@ QImage EditModeConstraintCoinManager::renderConstrIcon(const QString& type,
int* vPad)
{
// Constants to help create constraint icons
QString joinStr = QString::fromLatin1(", ");
QString joinStr = QStringLiteral(", ");
QPixmap pxMap;
std::stringstream constraintName;
@@ -2871,25 +2870,25 @@ QString EditModeConstraintCoinManager::iconTypeFromConstraint(Constraint* constr
switch (constraint->Type) {
case Horizontal:
return QString::fromLatin1("Constraint_Horizontal");
return QStringLiteral("Constraint_Horizontal");
case Vertical:
return QString::fromLatin1("Constraint_Vertical");
return QStringLiteral("Constraint_Vertical");
case PointOnObject:
return QString::fromLatin1("Constraint_PointOnObject");
return QStringLiteral("Constraint_PointOnObject");
case Tangent:
return QString::fromLatin1("Constraint_Tangent");
return QStringLiteral("Constraint_Tangent");
case Parallel:
return QString::fromLatin1("Constraint_Parallel");
return QStringLiteral("Constraint_Parallel");
case Perpendicular:
return QString::fromLatin1("Constraint_Perpendicular");
return QStringLiteral("Constraint_Perpendicular");
case Equal:
return QString::fromLatin1("Constraint_EqualLength");
return QStringLiteral("Constraint_EqualLength");
case Symmetric:
return QString::fromLatin1("Constraint_Symmetric");
return QStringLiteral("Constraint_Symmetric");
case SnellsLaw:
return QString::fromLatin1("Constraint_SnellsLaw");
return QStringLiteral("Constraint_SnellsLaw");
case Block:
return QString::fromLatin1("Constraint_Block");
return QStringLiteral("Constraint_Block");
default:
return QString();
}
@@ -296,10 +296,7 @@ void EditModeInformationOverlayCoinConverter::calculate(const Part::Geometry* ge
poleWeights.positions.emplace_back(poles[i]);
QString WeightString =
QString::fromLatin1("[%1]").arg(weights[i],
0,
'f',
Base::UnitsApi::getDecimals());
QStringLiteral("[%1]").arg(weights[i], 0, 'f', Base::UnitsApi::getDecimals());
poleWeights.strings.emplace_back(WeightString.toStdString());
}
@@ -83,7 +83,7 @@ void PropertyConstraintListItem::initialize()
PropertyUnitItem* item = static_cast<PropertyUnitItem*>(PropertyUnitItem::create());
// Get the name
QString internalName = QString::fromLatin1("Constraint%1").arg(id);
QString internalName = QStringLiteral("Constraint%1").arg(id);
QString name = QString::fromUtf8((*it)->Name.c_str());
if (name.isEmpty()) {
name = internalName;
@@ -214,7 +214,7 @@ void PropertyConstraintListItem::assignProperty(const App::Property* prop)
}
// Get the name
QString internalName = QString::fromLatin1("Constraint%1").arg(id);
QString internalName = QStringLiteral("Constraint%1").arg(id);
QString name = QString::fromUtf8((*it)->Name.c_str());
if (name.isEmpty()) {
name = internalName;
@@ -273,7 +273,7 @@ QVariant PropertyConstraintListItem::value(const App::Property* prop) const
// Use a 7-bit ASCII string for the internal name.
// See also comment in PropertyConstraintListItem::initialize()
QString internalName = QString::fromLatin1("Constraint%1").arg(id);
QString internalName = QStringLiteral("Constraint%1").arg(id);
if ((*it)->Name.empty() && !onlyUnnamed) {
onlyNamed = false;
@@ -342,7 +342,7 @@ bool PropertyConstraintListItem::event(QEvent* ev)
|| (*it)->Type == Sketcher::Angle) {
// Get the internal name
QString internalName = QString::fromLatin1("Constraint%1").arg(id + 1);
QString internalName = QStringLiteral("Constraint%1").arg(id + 1);
if (internalName == propName) {
double datum = quant.getValue();
if ((*it)->Type == Sketcher::Angle) {
@@ -157,7 +157,7 @@ public:
case Sketcher::Weight:
case Sketcher::Diameter:
case Sketcher::Angle:
name = QString::fromLatin1("%1 (%2)").arg(
name = QStringLiteral("%1 (%2)").arg(
name,
QString::fromStdString(constraint->getPresentationValue().getUserString()));
break;
@@ -171,7 +171,7 @@ public:
else {
n1 = 1 / v;
}
name = QString::fromLatin1("%1 (%2/%3)").arg(name).arg(n2).arg(n1);
name = QStringLiteral("%1 (%2/%3)").arg(name).arg(n2).arg(n1);
break;
}
case Sketcher::InternalAlignment:
@@ -186,13 +186,13 @@ public:
if (extended) {
if (constraint->Second == Sketcher::GeoEnum::GeoUndef) {
name = QString::fromLatin1("%1 [(%2,%3)]")
name = QStringLiteral("%1 [(%2,%3)]")
.arg(name)
.arg(constraint->First)
.arg(static_cast<int>(constraint->FirstPos));
}
else if (constraint->Third == Sketcher::GeoEnum::GeoUndef) {
name = QString::fromLatin1("%1 [(%2,%3),(%4,%5)]")
name = QStringLiteral("%1 [(%2,%3),(%4,%5)]")
.arg(name)
.arg(constraint->First)
.arg(static_cast<int>(constraint->FirstPos))
@@ -200,7 +200,7 @@ public:
.arg(static_cast<int>(constraint->SecondPos));
}
else {
name = QString::fromLatin1("%1 [(%2,%3),(%4,%5),(%6,%7)]")
name = QStringLiteral("%1 [(%2,%3),(%4,%5),(%6,%7)]")
.arg(name)
.arg(constraint->First)
.arg(static_cast<int>(constraint->FirstPos))
@@ -447,7 +447,7 @@ public:
protected:
QPixmap getIcon(const char* name, const QSize& size) const
{
QString key = QString::fromLatin1("%1_%2x%3")
QString key = QStringLiteral("%1_%2x%3")
.arg(QString::fromLatin1(name))
.arg(size.width())
.arg(size.height());
@@ -955,7 +955,7 @@ TaskSketcherConstraints::TaskSketcherConstraints(ViewProviderSketch* sketchView)
multiFilterStatus = filterList->getMultiFilter();
ui->listWidgetConstraints->setStyleSheet(QString::fromLatin1("margin-top: 0px"));
ui->listWidgetConstraints->setStyleSheet(QStringLiteral("margin-top: 0px"));
//NOLINTBEGIN
Gui::Application* app = Gui::Application::Instance;
@@ -1355,7 +1355,7 @@ void TaskSketcherConstraints::onSelectionChanged(const Gui::SelectionChanges& ms
if (strcmp(msg.pDocName, sketchView->getSketchObject()->getDocument()->getName()) == 0
&& strcmp(msg.pObjectName, sketchView->getSketchObject()->getNameInDocument()) == 0) {
if (msg.pSubName) {
QRegularExpression rx(QString::fromLatin1("^Constraint(\\d+)$"));
QRegularExpression rx(QStringLiteral("^Constraint(\\d+)$"));
QRegularExpressionMatch match;
QString expr = QString::fromLatin1(msg.pSubName);
boost::ignore_unused(expr.indexOf(rx, 0, &match));
@@ -1438,7 +1438,7 @@ void TaskSketcherConstraints::OnChange(Base::Subject<const char*>& rCaller, cons
void TaskSketcherConstraints::getSelectionGeoId(QString expr, int& geoid,
Sketcher::PointPos& pointpos)
{
QRegularExpression rxEdge(QString::fromLatin1("^Edge(\\d+)$"));
QRegularExpression rxEdge(QStringLiteral("^Edge(\\d+)$"));
QRegularExpressionMatch match;
boost::ignore_unused(expr.indexOf(rxEdge, 0, &match));
geoid = Sketcher::GeoEnum::GeoUndef;
@@ -1452,7 +1452,7 @@ void TaskSketcherConstraints::getSelectionGeoId(QString expr, int& geoid,
}
}
else {
QRegularExpression rxVertex(QString::fromLatin1("^Vertex(\\d+)$"));
QRegularExpression rxVertex(QStringLiteral("^Vertex(\\d+)$"));
boost::ignore_unused(expr.indexOf(rxVertex, 0, &match));
if (match.hasMatch()) {
+62 -62
View File
@@ -1195,7 +1195,7 @@ TaskSketcherElements::TaskSketcherElements(ViewProviderSketch* sketchView)
proxy = new QWidget(this);
ui->setupUi(proxy);
#ifdef Q_OS_MAC
QString cmdKey = QString::fromUtf8("\xe2\x8c\x98");// U+2318
QString cmdKey = QStringLiteral("\xe2\x8c\x98");// U+2318
#else
// translate the text (it's offered by Qt's translation files)
// but avoid being picked up by lupdate
@@ -1415,7 +1415,7 @@ void TaskSketcherElements::onSelectionChanged(const Gui::SelectionChanges& msg)
std::string shapetype(msg.pSubName);
// if-else edge vertex
if (shapetype.size() > 4 && shapetype.substr(0, 4) == "Edge") {
QRegularExpression rx(QString::fromLatin1("^Edge(\\d+)$"));
QRegularExpression rx(QStringLiteral("^Edge(\\d+)$"));
QRegularExpressionMatch match;
boost::ignore_unused(expr.indexOf(rx, 0, &match));
if (match.hasMatch()) {
@@ -1439,7 +1439,7 @@ void TaskSketcherElements::onSelectionChanged(const Gui::SelectionChanges& msg)
}
}
else if (shapetype.size() > 12 && shapetype.substr(0, 12) == "ExternalEdge") {
QRegularExpression rx(QString::fromLatin1("^ExternalEdge(\\d+)$"));
QRegularExpression rx(QStringLiteral("^ExternalEdge(\\d+)$"));
QRegularExpressionMatch match;
boost::ignore_unused(expr.indexOf(rx, 0, &match));
if (match.hasMatch()) {
@@ -1460,7 +1460,7 @@ void TaskSketcherElements::onSelectionChanged(const Gui::SelectionChanges& msg)
}
}
else if (shapetype.size() > 6 && shapetype.substr(0, 6) == "Vertex") {
QRegularExpression rx(QString::fromLatin1("^Vertex(\\d+)$"));
QRegularExpression rx(QStringLiteral("^Vertex(\\d+)$"));
QRegularExpressionMatch match;
boost::ignore_unused(expr.indexOf(rx, 0, &match));
if (match.hasMatch()) {
@@ -1811,9 +1811,9 @@ void TaskSketcherElements::slotElementsChanged()
auto IdInformation = [this, i, layerId]() {
if (sketchView->VisualLayerList.getSize() > 1)
return QString::fromLatin1("(Edge%1#ID%2#VL%3)").arg(i).arg(i - 1).arg(layerId);
return QStringLiteral("(Edge%1#ID%2#VL%3)").arg(i).arg(i - 1).arg(layerId);
else
return QString::fromLatin1("(Edge%1#ID%2)").arg(i).arg(i - 1);
return QStringLiteral("(Edge%1#ID%2)").arg(i).arg(i - 1);
};
ElementItem* itemN = new ElementItem(
@@ -1826,72 +1826,72 @@ void TaskSketcherElements::slotElementsChanged()
type == Part::GeomPoint::getClassTypeId()
? (isNamingBoxChecked ? (tr("Point") + IdInformation())
+ (construction
? (QString::fromLatin1("-") + tr("Construction"))
: (internalAligned ? (QString::fromLatin1("-") + tr("Internal"))
: QString::fromLatin1("")))
: (QString::fromLatin1("%1-").arg(i) + tr("Point")))
? (QStringLiteral("-") + tr("Construction"))
: (internalAligned ? (QStringLiteral("-") + tr("Internal"))
: QStringLiteral("")))
: (QStringLiteral("%1-").arg(i) + tr("Point")))
: type == Part::GeomLineSegment::getClassTypeId()
? (isNamingBoxChecked ? (tr("Line") + IdInformation())
+ (construction
? (QString::fromLatin1("-") + tr("Construction"))
: (internalAligned ? (QString::fromLatin1("-") + tr("Internal"))
: QString::fromLatin1("")))
: (QString::fromLatin1("%1-").arg(i) + tr("Line")))
? (QStringLiteral("-") + tr("Construction"))
: (internalAligned ? (QStringLiteral("-") + tr("Internal"))
: QStringLiteral("")))
: (QStringLiteral("%1-").arg(i) + tr("Line")))
: type == Part::GeomArcOfCircle::getClassTypeId()
? (isNamingBoxChecked ? (tr("Arc") + IdInformation())
+ (construction
? (QString::fromLatin1("-") + tr("Construction"))
: (internalAligned ? (QString::fromLatin1("-") + tr("Internal"))
: QString::fromLatin1("")))
: (QString::fromLatin1("%1-").arg(i) + tr("Arc")))
? (QStringLiteral("-") + tr("Construction"))
: (internalAligned ? (QStringLiteral("-") + tr("Internal"))
: QStringLiteral("")))
: (QStringLiteral("%1-").arg(i) + tr("Arc")))
: type == Part::GeomCircle::getClassTypeId()
? (isNamingBoxChecked ? (tr("Circle") + IdInformation())
+ (construction
? (QString::fromLatin1("-") + tr("Construction"))
: (internalAligned ? (QString::fromLatin1("-") + tr("Internal"))
: QString::fromLatin1("")))
: (QString::fromLatin1("%1-").arg(i) + tr("Circle")))
? (QStringLiteral("-") + tr("Construction"))
: (internalAligned ? (QStringLiteral("-") + tr("Internal"))
: QStringLiteral("")))
: (QStringLiteral("%1-").arg(i) + tr("Circle")))
: type == Part::GeomEllipse::getClassTypeId()
? (isNamingBoxChecked ? (tr("Ellipse") + IdInformation())
+ (construction
? (QString::fromLatin1("-") + tr("Construction"))
: (internalAligned ? (QString::fromLatin1("-") + tr("Internal"))
: QString::fromLatin1("")))
: (QString::fromLatin1("%1-").arg(i) + tr("Ellipse")))
? (QStringLiteral("-") + tr("Construction"))
: (internalAligned ? (QStringLiteral("-") + tr("Internal"))
: QStringLiteral("")))
: (QStringLiteral("%1-").arg(i) + tr("Ellipse")))
: type == Part::GeomArcOfEllipse::getClassTypeId()
? (isNamingBoxChecked ? (tr("Elliptical Arc") + IdInformation())
+ (construction
? (QString::fromLatin1("-") + tr("Construction"))
: (internalAligned ? (QString::fromLatin1("-") + tr("Internal"))
: QString::fromLatin1("")))
: (QString::fromLatin1("%1-").arg(i) + tr("Elliptical Arc")))
? (QStringLiteral("-") + tr("Construction"))
: (internalAligned ? (QStringLiteral("-") + tr("Internal"))
: QStringLiteral("")))
: (QStringLiteral("%1-").arg(i) + tr("Elliptical Arc")))
: type == Part::GeomArcOfHyperbola::getClassTypeId()
? (isNamingBoxChecked ? (tr("Hyperbolic Arc") + IdInformation())
+ (construction
? (QString::fromLatin1("-") + tr("Construction"))
: (internalAligned ? (QString::fromLatin1("-") + tr("Internal"))
: QString::fromLatin1("")))
: (QString::fromLatin1("%1-").arg(i) + tr("Hyperbolic Arc")))
? (QStringLiteral("-") + tr("Construction"))
: (internalAligned ? (QStringLiteral("-") + tr("Internal"))
: QStringLiteral("")))
: (QStringLiteral("%1-").arg(i) + tr("Hyperbolic Arc")))
: type == Part::GeomArcOfParabola::getClassTypeId()
? (isNamingBoxChecked ? (tr("Parabolic Arc") + IdInformation())
+ (construction
? (QString::fromLatin1("-") + tr("Construction"))
: (internalAligned ? (QString::fromLatin1("-") + tr("Internal"))
: QString::fromLatin1("")))
: (QString::fromLatin1("%1-").arg(i) + tr("Parabolic Arc")))
? (QStringLiteral("-") + tr("Construction"))
: (internalAligned ? (QStringLiteral("-") + tr("Internal"))
: QStringLiteral("")))
: (QStringLiteral("%1-").arg(i) + tr("Parabolic Arc")))
: type == Part::GeomBSplineCurve::getClassTypeId()
? (isNamingBoxChecked ? (tr("B-spline") + IdInformation())
+ (construction
? (QString::fromLatin1("-") + tr("Construction"))
: (internalAligned ? (QString::fromLatin1("-") + tr("Internal"))
: QString::fromLatin1("")))
: (QString::fromLatin1("%1-").arg(i) + tr("B-spline")))
? (QStringLiteral("-") + tr("Construction"))
: (internalAligned ? (QStringLiteral("-") + tr("Internal"))
: QStringLiteral("")))
: (QStringLiteral("%1-").arg(i) + tr("B-spline")))
: (isNamingBoxChecked ? (tr("Other") + IdInformation())
+ (construction
? (QString::fromLatin1("-") + tr("Construction"))
: (internalAligned ? (QString::fromLatin1("-") + tr("Internal"))
: QString::fromLatin1("")))
: (QString::fromLatin1("%1-").arg(i) + tr("Other"))),
? (QStringLiteral("-") + tr("Construction"))
: (internalAligned ? (QStringLiteral("-") + tr("Internal"))
: QStringLiteral("")))
: (QStringLiteral("%1-").arg(i) + tr("Other"))),
sketchView);
ui->listWidgetElements->addItem(itemN);
@@ -1919,13 +1919,13 @@ void TaskSketcherElements::slotElementsChanged()
auto IdInformation = [this, j, layerId](bool link) {
if (sketchView->VisualLayerList.getSize() > 1) {
if (link) {
return QString::fromLatin1("(ExternalEdge%1#ID%2#VL%3, ")
return QStringLiteral("(ExternalEdge%1#ID%2#VL%3, ")
.arg(j - 2)
.arg(-j)
.arg(layerId);
}
else {
return QString::fromLatin1("(ExternalEdge%1#ID%2#VL%3)")
return QStringLiteral("(ExternalEdge%1#ID%2#VL%3)")
.arg(j - 2)
.arg(-j)
.arg(layerId);
@@ -1933,10 +1933,10 @@ void TaskSketcherElements::slotElementsChanged()
}
else {
if (link) {
return QString::fromLatin1("(ExternalEdge%1#ID%2, ").arg(j - 2).arg(-j);
return QStringLiteral("(ExternalEdge%1#ID%2, ").arg(j - 2).arg(-j);
}
else {
return QString::fromLatin1("(ExternalEdge%1#ID%2)").arg(j - 2).arg(-j);
return QStringLiteral("(ExternalEdge%1#ID%2)").arg(j - 2).arg(-j);
}
}
};
@@ -1947,8 +1947,8 @@ void TaskSketcherElements::slotElementsChanged()
if (size_t(j - 3) < linkobjs.size() && size_t(j - 3) < linksubs.size()) {
linkname = IdInformation(true)
+ QString::fromUtf8(linkobjs[j - 3]->getNameInDocument())
+ QString::fromLatin1(".") + QString::fromUtf8(linksubs[j - 3].c_str())
+ QString::fromLatin1(")");
+ QStringLiteral(".") + QString::fromUtf8(linksubs[j - 3].c_str())
+ QStringLiteral(")");
}
else {
linkname = IdInformation(false);
@@ -1966,36 +1966,36 @@ void TaskSketcherElements::slotElementsChanged()
state,
type == Part::GeomPoint::getClassTypeId()
? (isNamingBoxChecked ? (tr("Point") + linkname)
: (QString::fromLatin1("%1-").arg(i - 2) + tr("Point")))
: (QStringLiteral("%1-").arg(i - 2) + tr("Point")))
: type == Part::GeomLineSegment::getClassTypeId()
? (isNamingBoxChecked ? (tr("Line") + linkname)
: (QString::fromLatin1("%1-").arg(i - 2) + tr("Line")))
: (QStringLiteral("%1-").arg(i - 2) + tr("Line")))
: type == Part::GeomArcOfCircle::getClassTypeId()
? (isNamingBoxChecked ? (tr("Arc") + linkname)
: (QString::fromLatin1("%1-").arg(i - 2) + tr("Arc")))
: (QStringLiteral("%1-").arg(i - 2) + tr("Arc")))
: type == Part::GeomCircle::getClassTypeId()
? (isNamingBoxChecked ? (tr("Circle") + linkname)
: (QString::fromLatin1("%1-").arg(i - 2) + tr("Circle")))
: (QStringLiteral("%1-").arg(i - 2) + tr("Circle")))
: type == Part::GeomEllipse::getClassTypeId()
? (isNamingBoxChecked ? (tr("Ellipse") + linkname)
: (QString::fromLatin1("%1-").arg(i - 2) + tr("Ellipse")))
: (QStringLiteral("%1-").arg(i - 2) + tr("Ellipse")))
: type == Part::GeomArcOfEllipse::getClassTypeId()
? (isNamingBoxChecked
? (tr("Elliptical Arc") + linkname)
: (QString::fromLatin1("%1-").arg(i - 2) + tr("Elliptical Arc")))
: (QStringLiteral("%1-").arg(i - 2) + tr("Elliptical Arc")))
: type == Part::GeomArcOfHyperbola::getClassTypeId()
? (isNamingBoxChecked
? (tr("Hyperbolic Arc") + linkname)
: (QString::fromLatin1("%1-").arg(i - 2) + tr("Hyperbolic Arc")))
: (QStringLiteral("%1-").arg(i - 2) + tr("Hyperbolic Arc")))
: type == Part::GeomArcOfParabola::getClassTypeId()
? (isNamingBoxChecked
? (tr("Parabolic Arc") + linkname)
: (QString::fromLatin1("%1-").arg(i - 2) + tr("Parabolic Arc")))
: (QStringLiteral("%1-").arg(i - 2) + tr("Parabolic Arc")))
: type == Part::GeomBSplineCurve::getClassTypeId()
? (isNamingBoxChecked ? (tr("B-spline") + linkname)
: (QString::fromLatin1("%1-").arg(i - 2) + tr("B-spline")))
: (QStringLiteral("%1-").arg(i - 2) + tr("B-spline")))
: (isNamingBoxChecked ? (tr("Other") + linkname)
: (QString::fromLatin1("%1-").arg(i - 2) + tr("Other"))),
: (QStringLiteral("%1-").arg(i - 2) + tr("Other"))),
sketchView);
ui->listWidgetElements->addItem(itemN);
+18 -18
View File
@@ -62,28 +62,28 @@ TaskSketcherMessages::TaskSketcherMessages(ViewProviderSketch* sketchView)
// Set up the possible state values for the status label
ui->labelConstrainStatus->setParameterGroup(
"User parameter:BaseApp/Preferences/Mod/Sketcher/General");
ui->labelConstrainStatus->registerState(QString::fromUtf8("empty_sketch"),
ui->labelConstrainStatus->registerState(QStringLiteral("empty_sketch"),
palette().windowText().color(),
std::string("EmptySketchMessageColor"));
ui->labelConstrainStatus->registerState(QString::fromUtf8("under_constrained"),
ui->labelConstrainStatus->registerState(QStringLiteral("under_constrained"),
palette().windowText().color(),
std::string("UnderconstrainedMessageColor"));
ui->labelConstrainStatus->registerState(QString::fromUtf8("malformed_constraints"),
ui->labelConstrainStatus->registerState(QStringLiteral("malformed_constraints"),
QColor("red"),
std::string("MalformedConstraintMessageColor"));
ui->labelConstrainStatus->registerState(QString::fromUtf8("conflicting_constraints"),
ui->labelConstrainStatus->registerState(QStringLiteral("conflicting_constraints"),
QColor("orangered"),
std::string("ConflictingConstraintMessageColor"));
ui->labelConstrainStatus->registerState(QString::fromUtf8("redundant_constraints"),
ui->labelConstrainStatus->registerState(QStringLiteral("redundant_constraints"),
QColor("red"),
std::string("RedundantConstraintMessageColor"));
ui->labelConstrainStatus->registerState(
QString::fromUtf8("partially_redundant_constraints"),
QStringLiteral("partially_redundant_constraints"),
QColor("royalblue"),
std::string("PartiallyRedundantConstraintMessageColor"));
ui->labelConstrainStatus->registerState(
QString::fromUtf8("solver_failed"), QColor("red"), std::string("SolverFailedMessageColor"));
ui->labelConstrainStatus->registerState(QString::fromUtf8("fully_constrained"),
QStringLiteral("solver_failed"), QColor("red"), std::string("SolverFailedMessageColor"));
ui->labelConstrainStatus->registerState(QStringLiteral("fully_constrained"),
QColor("green"),
std::string("FullyConstrainedMessageColor"));
@@ -137,18 +137,18 @@ void TaskSketcherMessages::slotSetUp(const QString& state, const QString& msg, c
void TaskSketcherMessages::updateToolTip(const QString& link)
{
if (link == QString::fromLatin1("#conflicting"))
if (link == QStringLiteral("#conflicting"))
ui->labelConstrainStatusLink->setToolTip(
tr("Click to select these conflicting constraints."));
else if (link == QString::fromLatin1("#redundant"))
else if (link == QStringLiteral("#redundant"))
ui->labelConstrainStatusLink->setToolTip(tr("Click to select these redundant constraints."));
else if (link == QString::fromLatin1("#dofs"))
else if (link == QStringLiteral("#dofs"))
ui->labelConstrainStatusLink->setToolTip(
tr("The sketch has unconstrained elements giving rise to those Degrees Of Freedom. "
"Click to select these unconstrained elements."));
else if (link == QString::fromLatin1("#malformed"))
else if (link == QStringLiteral("#malformed"))
ui->labelConstrainStatusLink->setToolTip(tr("Click to select these malformed constraints."));
else if (link == QString::fromLatin1("#partiallyredundant"))
else if (link == QStringLiteral("#partiallyredundant"))
ui->labelConstrainStatusLink->setToolTip(
tr("Some constraints in combination are partially redundant. Click to select these "
"partially redundant constraints."));
@@ -156,19 +156,19 @@ void TaskSketcherMessages::updateToolTip(const QString& link)
void TaskSketcherMessages::onLabelConstrainStatusLinkClicked(const QString& str)
{
if (str == QString::fromLatin1("#conflicting"))
if (str == QStringLiteral("#conflicting"))
Gui::Application::Instance->commandManager().runCommandByName(
"Sketcher_SelectConflictingConstraints");
else if (str == QString::fromLatin1("#redundant"))
else if (str == QStringLiteral("#redundant"))
Gui::Application::Instance->commandManager().runCommandByName(
"Sketcher_SelectRedundantConstraints");
else if (str == QString::fromLatin1("#dofs"))
else if (str == QStringLiteral("#dofs"))
Gui::Application::Instance->commandManager().runCommandByName(
"Sketcher_SelectElementsWithDoFs");
else if (str == QString::fromLatin1("#malformed"))
else if (str == QStringLiteral("#malformed"))
Gui::Application::Instance->commandManager().runCommandByName(
"Sketcher_SelectMalformedConstraints");
else if (str == QString::fromLatin1("#partiallyredundant"))
else if (str == QStringLiteral("#partiallyredundant"))
Gui::Application::Instance->commandManager().runCommandByName(
"Sketcher_SelectPartiallyRedundantConstraints");
}
@@ -188,9 +188,9 @@ void TaskSketcherSolverAdvanced::updateDefaultMethodParameters()
switch (currentindex) {
case 0: // BFGS
ui->labelSolverParam1->setText(QString::fromLatin1(""));
ui->labelSolverParam2->setText(QString::fromLatin1(""));
ui->labelSolverParam3->setText(QString::fromLatin1(""));
ui->labelSolverParam1->setText(QStringLiteral(""));
ui->labelSolverParam2->setText(QStringLiteral(""));
ui->labelSolverParam3->setText(QStringLiteral(""));
ui->lineEditSolverParam1->clear();
ui->lineEditSolverParam2->clear();
ui->lineEditSolverParam3->clear();
@@ -200,9 +200,9 @@ void TaskSketcherSolverAdvanced::updateDefaultMethodParameters()
break;
case 1: // LM
{
ui->labelSolverParam1->setText(QString::fromLatin1("Eps"));
ui->labelSolverParam2->setText(QString::fromLatin1("Eps1"));
ui->labelSolverParam3->setText(QString::fromLatin1("Tau"));
ui->labelSolverParam1->setText(QStringLiteral("Eps"));
ui->labelSolverParam2->setText(QStringLiteral("Eps1"));
ui->labelSolverParam3->setText(QStringLiteral("Tau"));
ui->lineEditSolverParam1->setEnabled(true);
ui->lineEditSolverParam2->setEnabled(true);
ui->lineEditSolverParam3->setEnabled(true);
@@ -211,17 +211,11 @@ void TaskSketcherSolverAdvanced::updateDefaultMethodParameters()
::atof(hGrp->GetASCII("LM_eps1", QString::number(LM_EPS1).toUtf8()).c_str());
double tau = ::atof(hGrp->GetASCII("LM_tau", QString::number(LM_TAU).toUtf8()).c_str());
ui->lineEditSolverParam1->setText(QString::number(eps).remove(
QString::fromLatin1("+")
.replace(QString::fromLatin1("e0"), QString::fromLatin1("E"))
.toUpper()));
QStringLiteral("+").replace(QStringLiteral("e0"), QStringLiteral("E")).toUpper()));
ui->lineEditSolverParam2->setText(QString::number(eps1).remove(
QString::fromLatin1("+")
.replace(QString::fromLatin1("e0"), QString::fromLatin1("E"))
.toUpper()));
QStringLiteral("+").replace(QStringLiteral("e0"), QStringLiteral("E")).toUpper()));
ui->lineEditSolverParam3->setText(QString::number(tau).remove(
QString::fromLatin1("+")
.replace(QString::fromLatin1("e0"), QString::fromLatin1("E"))
.toUpper()));
QStringLiteral("+").replace(QStringLiteral("e0"), QStringLiteral("E")).toUpper()));
// SketchObject has encapsulated write-access. The current use of const_cast just for
// configuration is deemed acceptable. Eventually this dialog should be rewritten to
// include only useful information and the configuration centralised in an individual
@@ -237,9 +231,9 @@ void TaskSketcherSolverAdvanced::updateDefaultMethodParameters()
}
case 2: // DogLeg
{
ui->labelSolverParam1->setText(QString::fromLatin1("Tolg"));
ui->labelSolverParam2->setText(QString::fromLatin1("Tolx"));
ui->labelSolverParam3->setText(QString::fromLatin1("Tolf"));
ui->labelSolverParam1->setText(QStringLiteral("Tolg"));
ui->labelSolverParam2->setText(QStringLiteral("Tolx"));
ui->labelSolverParam3->setText(QStringLiteral("Tolf"));
ui->lineEditSolverParam1->setEnabled(true);
ui->lineEditSolverParam2->setEnabled(true);
ui->lineEditSolverParam3->setEnabled(true);
@@ -250,17 +244,11 @@ void TaskSketcherSolverAdvanced::updateDefaultMethodParameters()
double tolf =
::atof(hGrp->GetASCII("DL_tolf", QString::number(DL_TOLF).toUtf8()).c_str());
ui->lineEditSolverParam1->setText(QString::number(tolg).remove(
QString::fromLatin1("+")
.replace(QString::fromLatin1("e0"), QString::fromLatin1("E"))
.toUpper()));
QStringLiteral("+").replace(QStringLiteral("e0"), QStringLiteral("E")).toUpper()));
ui->lineEditSolverParam2->setText(QString::number(tolx).remove(
QString::fromLatin1("+")
.replace(QString::fromLatin1("e0"), QString::fromLatin1("E"))
.toUpper()));
QStringLiteral("+").replace(QStringLiteral("e0"), QStringLiteral("E")).toUpper()));
ui->lineEditSolverParam3->setText(QString::number(tolf).remove(
QString::fromLatin1("+")
.replace(QString::fromLatin1("e0"), QString::fromLatin1("E"))
.toUpper()));
QStringLiteral("+").replace(QStringLiteral("e0"), QStringLiteral("E")).toUpper()));
const_cast<Sketcher::Sketch&>(sketchView->getSketchObject()->getSolvedSketch())
.setDL_tolg(tolg);
const_cast<Sketcher::Sketch&>(sketchView->getSketchObject()->getSolvedSketch())
@@ -289,9 +277,9 @@ void TaskSketcherSolverAdvanced::updateRedundantMethodParameters()
switch (redundantcurrentindex) {
case 0: // BFGS
ui->labelRedundantSolverParam1->setText(QString::fromLatin1(""));
ui->labelRedundantSolverParam2->setText(QString::fromLatin1(""));
ui->labelRedundantSolverParam3->setText(QString::fromLatin1(""));
ui->labelRedundantSolverParam1->setText(QStringLiteral(""));
ui->labelRedundantSolverParam2->setText(QStringLiteral(""));
ui->labelRedundantSolverParam3->setText(QStringLiteral(""));
ui->lineEditRedundantSolverParam1->clear();
ui->lineEditRedundantSolverParam2->clear();
ui->lineEditRedundantSolverParam3->clear();
@@ -301,9 +289,9 @@ void TaskSketcherSolverAdvanced::updateRedundantMethodParameters()
break;
case 1: // LM
{
ui->labelRedundantSolverParam1->setText(QString::fromLatin1("R.Eps"));
ui->labelRedundantSolverParam2->setText(QString::fromLatin1("R.Eps1"));
ui->labelRedundantSolverParam3->setText(QString::fromLatin1("R.Tau"));
ui->labelRedundantSolverParam1->setText(QStringLiteral("R.Eps"));
ui->labelRedundantSolverParam2->setText(QStringLiteral("R.Eps1"));
ui->labelRedundantSolverParam3->setText(QStringLiteral("R.Tau"));
ui->lineEditRedundantSolverParam1->setEnabled(true);
ui->lineEditRedundantSolverParam2->setEnabled(true);
ui->lineEditRedundantSolverParam3->setEnabled(true);
@@ -314,17 +302,11 @@ void TaskSketcherSolverAdvanced::updateRedundantMethodParameters()
double tau = ::atof(
hGrp->GetASCII("Redundant_LM_tau", QString::number(LM_TAU).toUtf8()).c_str());
ui->lineEditRedundantSolverParam1->setText(QString::number(eps).remove(
QString::fromLatin1("+")
.replace(QString::fromLatin1("e0"), QString::fromLatin1("E"))
.toUpper()));
QStringLiteral("+").replace(QStringLiteral("e0"), QStringLiteral("E")).toUpper()));
ui->lineEditRedundantSolverParam2->setText(QString::number(eps1).remove(
QString::fromLatin1("+")
.replace(QString::fromLatin1("e0"), QString::fromLatin1("E"))
.toUpper()));
QStringLiteral("+").replace(QStringLiteral("e0"), QStringLiteral("E")).toUpper()));
ui->lineEditRedundantSolverParam3->setText(QString::number(tau).remove(
QString::fromLatin1("+")
.replace(QString::fromLatin1("e0"), QString::fromLatin1("E"))
.toUpper()));
QStringLiteral("+").replace(QStringLiteral("e0"), QStringLiteral("E")).toUpper()));
const_cast<Sketcher::Sketch&>(sketchView->getSketchObject()->getSolvedSketch())
.setLM_epsRedundant(eps);
const_cast<Sketcher::Sketch&>(sketchView->getSketchObject()->getSolvedSketch())
@@ -335,9 +317,9 @@ void TaskSketcherSolverAdvanced::updateRedundantMethodParameters()
}
case 2: // DogLeg
{
ui->labelRedundantSolverParam1->setText(QString::fromLatin1("R.Tolg"));
ui->labelRedundantSolverParam2->setText(QString::fromLatin1("R.Tolx"));
ui->labelRedundantSolverParam3->setText(QString::fromLatin1("R.Tolf"));
ui->labelRedundantSolverParam1->setText(QStringLiteral("R.Tolg"));
ui->labelRedundantSolverParam2->setText(QStringLiteral("R.Tolx"));
ui->labelRedundantSolverParam3->setText(QStringLiteral("R.Tolf"));
ui->lineEditRedundantSolverParam1->setEnabled(true);
ui->lineEditRedundantSolverParam2->setEnabled(true);
ui->lineEditRedundantSolverParam3->setEnabled(true);
@@ -348,17 +330,11 @@ void TaskSketcherSolverAdvanced::updateRedundantMethodParameters()
double tolf = ::atof(
hGrp->GetASCII("Redundant_DL_tolf", QString::number(DL_TOLF).toUtf8()).c_str());
ui->lineEditRedundantSolverParam1->setText(QString::number(tolg).remove(
QString::fromLatin1("+")
.replace(QString::fromLatin1("e0"), QString::fromLatin1("E"))
.toUpper()));
QStringLiteral("+").replace(QStringLiteral("e0"), QStringLiteral("E")).toUpper()));
ui->lineEditRedundantSolverParam2->setText(QString::number(tolx).remove(
QString::fromLatin1("+")
.replace(QString::fromLatin1("e0"), QString::fromLatin1("E"))
.toUpper()));
QStringLiteral("+").replace(QStringLiteral("e0"), QStringLiteral("E")).toUpper()));
ui->lineEditRedundantSolverParam3->setText(QString::number(tolf).remove(
QString::fromLatin1("+")
.replace(QString::fromLatin1("e0"), QString::fromLatin1("E"))
.toUpper()));
QStringLiteral("+").replace(QStringLiteral("e0"), QStringLiteral("E")).toUpper()));
const_cast<Sketcher::Sketch&>(sketchView->getSketchObject()->getSolvedSketch())
.setDL_tolgRedundant(tolg);
const_cast<Sketcher::Sketch&>(sketchView->getSketchObject()->getSolvedSketch())
@@ -375,8 +351,8 @@ void TaskSketcherSolverAdvanced::onLineEditSolverParam1EditingFinished()
QString text = ui->lineEditSolverParam1->text();
double val = text.toDouble();
QString sci = QString::number(val);
sci.remove(QString::fromLatin1("+"));
sci.replace(QString::fromLatin1("e0"), QString::fromLatin1("E"));
sci.remove(QStringLiteral("+"));
sci.replace(QStringLiteral("e0"), QStringLiteral("E"));
ui->lineEditSolverParam1->setText(sci.toUpper());
switch (ui->comboBoxDefaultSolver->currentIndex()) {
@@ -404,8 +380,8 @@ void TaskSketcherSolverAdvanced::onLineEditRedundantSolverParam1EditingFinished(
QString text = ui->lineEditRedundantSolverParam1->text();
double val = text.toDouble();
QString sci = QString::number(val);
sci.remove(QString::fromLatin1("+"));
sci.replace(QString::fromLatin1("e0"), QString::fromLatin1("E"));
sci.remove(QStringLiteral("+"));
sci.replace(QStringLiteral("e0"), QStringLiteral("E"));
ui->lineEditRedundantSolverParam1->setText(sci.toUpper());
switch (ui->comboBoxDefaultSolver->currentIndex()) {
@@ -433,8 +409,8 @@ void TaskSketcherSolverAdvanced::onLineEditSolverParam2EditingFinished()
QString text = ui->lineEditSolverParam2->text();
double val = text.toDouble();
QString sci = QString::number(val);
sci.remove(QString::fromLatin1("+"));
sci.replace(QString::fromLatin1("e0"), QString::fromLatin1("E"));
sci.remove(QStringLiteral("+"));
sci.replace(QStringLiteral("e0"), QStringLiteral("E"));
ui->lineEditSolverParam2->setText(sci.toUpper());
switch (ui->comboBoxDefaultSolver->currentIndex()) {
@@ -462,8 +438,8 @@ void TaskSketcherSolverAdvanced::onLineEditRedundantSolverParam2EditingFinished(
QString text = ui->lineEditRedundantSolverParam2->text();
double val = text.toDouble();
QString sci = QString::number(val);
sci.remove(QString::fromLatin1("+"));
sci.replace(QString::fromLatin1("e0"), QString::fromLatin1("E"));
sci.remove(QStringLiteral("+"));
sci.replace(QStringLiteral("e0"), QStringLiteral("E"));
ui->lineEditRedundantSolverParam2->setText(sci.toUpper());
switch (ui->comboBoxDefaultSolver->currentIndex()) {
@@ -491,8 +467,8 @@ void TaskSketcherSolverAdvanced::onLineEditSolverParam3EditingFinished()
QString text = ui->lineEditSolverParam3->text();
double val = text.toDouble();
QString sci = QString::number(val);
sci.remove(QString::fromLatin1("+"));
sci.replace(QString::fromLatin1("e0"), QString::fromLatin1("E"));
sci.remove(QStringLiteral("+"));
sci.replace(QStringLiteral("e0"), QStringLiteral("E"));
ui->lineEditSolverParam3->setText(sci.toUpper());
switch (ui->comboBoxDefaultSolver->currentIndex()) {
@@ -520,8 +496,8 @@ void TaskSketcherSolverAdvanced::onLineEditRedundantSolverParam3EditingFinished(
QString text = ui->lineEditRedundantSolverParam3->text();
double val = text.toDouble();
QString sci = QString::number(val);
sci.remove(QString::fromLatin1("+"));
sci.replace(QString::fromLatin1("e0"), QString::fromLatin1("E"));
sci.remove(QStringLiteral("+"));
sci.replace(QStringLiteral("e0"), QStringLiteral("E"));
ui->lineEditRedundantSolverParam3->setText(sci.toUpper());
switch (ui->comboBoxDefaultSolver->currentIndex()) {
@@ -585,8 +561,8 @@ void TaskSketcherSolverAdvanced::onLineEditQRPivotThresholdEditingFinished()
QString text = ui->lineEditQRPivotThreshold->text();
double val = text.toDouble();
QString sci = QString::number(val);
sci.remove(QString::fromLatin1("+"));
sci.replace(QString::fromLatin1("e0"), QString::fromLatin1("E"));
sci.remove(QStringLiteral("+"));
sci.replace(QStringLiteral("e0"), QStringLiteral("E"));
ui->lineEditQRPivotThreshold->setText(sci.toUpper());
ui->lineEditQRPivotThreshold->onSave();
@@ -600,8 +576,8 @@ void TaskSketcherSolverAdvanced::onLineEditConvergenceEditingFinished()
QString text = ui->lineEditConvergence->text();
double val = text.toDouble();
QString sci = QString::number(val);
sci.remove(QString::fromLatin1("+"));
sci.replace(QString::fromLatin1("e0"), QString::fromLatin1("E"));
sci.remove(QStringLiteral("+"));
sci.replace(QStringLiteral("e0"), QStringLiteral("E"));
ui->lineEditConvergence->setText(sci.toUpper());
ui->lineEditConvergence->onSave();
@@ -615,8 +591,8 @@ void TaskSketcherSolverAdvanced::onLineEditRedundantConvergenceEditingFinished()
QString text = ui->lineEditRedundantConvergence->text();
double val = text.toDouble();
QString sci = QString::number(val);
sci.remove(QString::fromLatin1("+"));
sci.replace(QString::fromLatin1("e0"), QString::fromLatin1("E"));
sci.remove(QStringLiteral("+"));
sci.replace(QStringLiteral("e0"), QStringLiteral("E"));
ui->lineEditRedundantConvergence->setText(sci.toUpper());
ui->lineEditRedundantConvergence->onSave();
+6 -6
View File
@@ -726,7 +726,7 @@ std::string SketcherGui::lengthToDisplayFormat(double value, int digits)
// get the numeric part of the user string
QRegularExpression rxNoUnits(
QString::fromUtf8("(.*) \\D*$")); // text before space + any non digits at end of string
QStringLiteral("(.*) \\D*$")); // text before space + any non digits at end of string
QRegularExpressionMatch match = rxNoUnits.match(QString::fromStdString(userString));
if (!match.hasMatch()) {
// no units in userString?
@@ -776,10 +776,10 @@ std::string SketcherGui::angleToDisplayFormat(double value, int digits)
if (Base::UnitsApi::isMultiUnitAngle()) {
// just return the user string
// Coin SbString doesn't handle utf8 well, so we convert to ascii
QString schemeMinute = QString::fromUtf8("\xE2\x80\xB2"); // prime symbol
QString schemeSecond = QString::fromUtf8("\xE2\x80\xB3"); // double prime symbol
QString escapeMinute = QString::fromLatin1("\'"); // substitute ascii single quote
QString escapeSecond = QString::fromLatin1("\""); // substitute ascii double quote
QString schemeMinute = QStringLiteral("\xE2\x80\xB2"); // prime symbol
QString schemeSecond = QStringLiteral("\xE2\x80\xB3"); // double prime symbol
QString escapeMinute = QStringLiteral("\'"); // substitute ascii single quote
QString escapeSecond = QStringLiteral("\""); // substitute ascii double quote
QString displayString = qUserString.replace(schemeMinute, escapeMinute);
displayString = displayString.replace(schemeSecond, escapeSecond);
return displayString.toStdString();
@@ -791,7 +791,7 @@ std::string SketcherGui::angleToDisplayFormat(double value, int digits)
auto decimalSep = QLocale().decimalPoint();
// get the numeric part of the user string
QRegularExpression rxNoUnits(QString::fromUtf8("(\\d*\\%1?\\d*)(\\D*)$")
QRegularExpression rxNoUnits(QStringLiteral("(\\d*\\%1?\\d*)(\\D*)$")
.arg(decimalSep)); // number + non digits at end of string
QRegularExpressionMatch match = rxNoUnits.match(qUserString);
if (!match.hasMatch()) {
+25 -25
View File
@@ -3050,7 +3050,7 @@ bool ViewProviderSketch::setEdit(int ModNum)
Gui::Command::addModule(Gui::Command::Gui, "Show");
try {
QString cmdstr =
QString::fromLatin1(
QStringLiteral(
"ActiveSketch = App.getDocument('%1').getObject('%2')\n"
"tv = Show.TempoVis(App.ActiveDocument, tag= ActiveSketch.ViewObject.TypeId)\n"
"ActiveSketch.ViewObject.TempoVis = tv\n"
@@ -3200,16 +3200,16 @@ inline QString intListHelper(const std::vector<int>& ints)
if (ints.size() < 8) {// The 8 is a bit heuristic... more than that and we shift formats
for (const auto i : ints) {
if (results.isEmpty())
results.append(QString::fromUtf8("%1").arg(i));
results.append(QStringLiteral("%1").arg(i));
else
results.append(QString::fromUtf8(", %1").arg(i));
results.append(QStringLiteral(", %1").arg(i));
}
}
else {
const int numToShow = 3;
int more = ints.size() - numToShow;
for (int i = 0; i < numToShow; ++i) {
results.append(QString::fromUtf8("%1, ").arg(ints[i]));
results.append(QStringLiteral("%1, ").arg(ints[i]));
}
results.append(QCoreApplication::translate("ViewProviderSketch", "and %1 more").arg(more));
}
@@ -3227,51 +3227,51 @@ void ViewProviderSketch::UpdateSolverInformation()
bool hasMalformed = getSketchObject()->getLastHasMalformedConstraints();
if (getSketchObject()->Geometry.getSize() == 0) {
signalSetUp(QString::fromUtf8("empty_sketch"), tr("Empty sketch"), QString(), QString());
signalSetUp(QStringLiteral("empty_sketch"), tr("Empty sketch"), QString(), QString());
}
else if (dofs < 0 || hasConflicts) {// over-constrained sketch
signalSetUp(
QString::fromUtf8("conflicting_constraints"),
QStringLiteral("conflicting_constraints"),
tr("Over-constrained:") + QLatin1String(" "),
QString::fromUtf8("#conflicting"),
QString::fromUtf8("(%1)").arg(intListHelper(getSketchObject()->getLastConflicting())));
QStringLiteral("#conflicting"),
QStringLiteral("(%1)").arg(intListHelper(getSketchObject()->getLastConflicting())));
}
else if (hasMalformed) {// malformed constraints
signalSetUp(QString::fromUtf8("malformed_constraints"),
signalSetUp(QStringLiteral("malformed_constraints"),
tr("Malformed constraints:") + QLatin1String(" "),
QString::fromUtf8("#malformed"),
QString::fromUtf8("(%1)").arg(
QStringLiteral("#malformed"),
QStringLiteral("(%1)").arg(
intListHelper(getSketchObject()->getLastMalformedConstraints())));
}
else if (hasRedundancies) {
signalSetUp(
QString::fromUtf8("redundant_constraints"),
QStringLiteral("redundant_constraints"),
tr("Redundant constraints:") + QLatin1String(" "),
QString::fromUtf8("#redundant"),
QString::fromUtf8("(%1)").arg(intListHelper(getSketchObject()->getLastRedundant())));
QStringLiteral("#redundant"),
QStringLiteral("(%1)").arg(intListHelper(getSketchObject()->getLastRedundant())));
}
else if (hasPartiallyRedundant) {
signalSetUp(QString::fromUtf8("partially_redundant_constraints"),
signalSetUp(QStringLiteral("partially_redundant_constraints"),
tr("Partially redundant:") + QLatin1String(" "),
QString::fromUtf8("#partiallyredundant"),
QString::fromUtf8("(%1)").arg(
QStringLiteral("#partiallyredundant"),
QStringLiteral("(%1)").arg(
intListHelper(getSketchObject()->getLastPartiallyRedundant())));
}
else if (getSketchObject()->getLastSolverStatus() != 0) {
signalSetUp(QString::fromUtf8("solver_failed"),
signalSetUp(QStringLiteral("solver_failed"),
tr("Solver failed to converge"),
QString::fromUtf8(""),
QString::fromUtf8(""));
QStringLiteral(""),
QStringLiteral(""));
}
else if (dofs > 0) {
signalSetUp(QString::fromUtf8("under_constrained"),
signalSetUp(QStringLiteral("under_constrained"),
tr("Under-constrained:") + QLatin1String(" "),
QString::fromUtf8("#dofs"),
QStringLiteral("#dofs"),
tr("%n DoF(s)", "", dofs));
}
else {
signalSetUp(
QString::fromUtf8("fully_constrained"), tr("Fully constrained"), QString(), QString());
QStringLiteral("fully_constrained"), tr("Fully constrained"), QString(), QString());
}
}
@@ -3349,7 +3349,7 @@ void ViewProviderSketch::unsetEdit(int ModNum)
// visibility automation
try {
QString cmdstr =
QString::fromLatin1("ActiveSketch = App.getDocument('%1').getObject('%2')\n"
QStringLiteral("ActiveSketch = App.getDocument('%1').getObject('%2')\n"
"tv = ActiveSketch.ViewObject.TempoVis\n"
"if tv:\n"
" tv.restore()\n"
@@ -3377,7 +3377,7 @@ void ViewProviderSketch::setEditViewer(Gui::View3DInventorViewer* viewer, int Mo
if (!this->TempoVis.getValue().isNone()) {
try {
QString cmdstr =
QString::fromLatin1(
QStringLiteral(
"ActiveSketch = App.getDocument('%1').getObject('%2')\n"
"if ActiveSketch.ViewObject.RestoreCamera:\n"
" ActiveSketch.ViewObject.TempoVis.saveCamera()\n"
+8 -8
View File
@@ -160,18 +160,18 @@ namespace
{
inline const QStringList editModeToolbarNames()
{
return QStringList {QString::fromLatin1("Sketcher edit mode"),
QString::fromLatin1("Sketcher geometries"),
QString::fromLatin1("Sketcher constraints"),
QString::fromLatin1("Sketcher tools"),
QString::fromLatin1("Sketcher B-spline tools"),
QString::fromLatin1("Sketcher visual"),
QString::fromLatin1("Sketcher edit tools")};
return QStringList {QStringLiteral("Sketcher edit mode"),
QStringLiteral("Sketcher geometries"),
QStringLiteral("Sketcher constraints"),
QStringLiteral("Sketcher tools"),
QStringLiteral("Sketcher B-spline tools"),
QStringLiteral("Sketcher visual"),
QStringLiteral("Sketcher edit tools")};
}
inline const QStringList nonEditModeToolbarNames()
{
return QStringList {QString::fromLatin1("Structure"), QString::fromLatin1("Sketcher")};
return QStringList {QStringLiteral("Structure"), QStringLiteral("Sketcher")};
}
} // namespace