diff --git a/src/Base/UnitsSchemaCentimeters.cpp b/src/Base/UnitsSchemaCentimeters.cpp index 033e5584347e..58a6d84b27b5 100644 --- a/src/Base/UnitsSchemaCentimeters.cpp +++ b/src/Base/UnitsSchemaCentimeters.cpp @@ -41,33 +41,33 @@ QString UnitsSchemaCentimeters::schemaTranslate(const Base::Quantity& quant, Unit unit = quant.getUnit(); if (unit == Unit::Length) { // all length units in centimeters - unitString = QString::fromLatin1("cm"); + unitString = QLatin1String("cm"); factor = 10.0; } else if (unit == Unit::Area) { // all area units in square meters - unitString = QString::fromLatin1("m^2"); + unitString = QLatin1String("m^2"); factor = 1000000.0; } else if (unit == Unit::Volume) { // all area units in cubic meters - unitString = QString::fromLatin1("m^3"); + unitString = QLatin1String("m^3"); factor = 1000000000.0; } else if (unit == Unit::Power) { - unitString = QString::fromLatin1("W"); + unitString = QLatin1String("W"); factor = 1000000; } else if (unit == Unit::ElectricPotential) { - unitString = QString::fromLatin1("V"); + unitString = QLatin1String("V"); factor = 1000000; } else if (unit == Unit::HeatFlux) { - unitString = QString::fromLatin1("W/m^2"); + unitString = QLatin1String("W/m^2"); factor = 1.0; } else if (unit == Unit::Velocity) { - unitString = QString::fromLatin1("mm/min"); + unitString = QLatin1String("mm/min"); factor = 1.0 / 60; } else { diff --git a/src/Base/UnitsSchemaFemMilliMeterNewton.cpp b/src/Base/UnitsSchemaFemMilliMeterNewton.cpp index 9baf47a9208a..898178ad1608 100644 --- a/src/Base/UnitsSchemaFemMilliMeterNewton.cpp +++ b/src/Base/UnitsSchemaFemMilliMeterNewton.cpp @@ -42,12 +42,12 @@ QString UnitsSchemaFemMilliMeterNewton::schemaTranslate(const Quantity& quant, Unit unit = quant.getUnit(); if (unit == Unit::Length) { // all length units in millimeters - unitString = QString::fromLatin1("mm"); + unitString = QLatin1String("mm"); factor = 1.0; } else if (unit == Unit::Mass) { // all mass units in t - unitString = QString::fromUtf8("t"); + unitString = QLatin1String("t"); factor = 1e3; } else { diff --git a/src/Base/UnitsSchemaImperial1.cpp b/src/Base/UnitsSchemaImperial1.cpp index 37c6d3086077..10762ca4504c 100644 --- a/src/Base/UnitsSchemaImperial1.cpp +++ b/src/Base/UnitsSchemaImperial1.cpp @@ -49,31 +49,31 @@ UnitsSchemaImperial1::schemaTranslate(const Quantity& quant, double& factor, QSt // now do special treatment on all cases seems necessary: if (unit == Unit::Length) { // Length handling ============================ if (UnitValue < 0.00000254) { // smaller then 0.001 thou -> inch and scientific notation - unitString = QString::fromLatin1("in"); + unitString = QLatin1String("in"); factor = 25.4; } else if (UnitValue < 2.54) { // smaller then 0.1 inch -> Thou (mil) - unitString = QString::fromLatin1("thou"); + unitString = QLatin1String("thou"); factor = 0.0254; } else if (UnitValue < 304.8) { - unitString = QString::fromLatin1("\""); + unitString = QLatin1String("\""); factor = 25.4; } else if (UnitValue < 914.4) { - unitString = QString::fromLatin1("\'"); + unitString = QLatin1String("\'"); factor = 304.8; } else if (UnitValue < 1609344.0) { - unitString = QString::fromLatin1("yd"); + unitString = QLatin1String("yd"); factor = 914.4; } else if (UnitValue < 1609344000.0) { - unitString = QString::fromLatin1("mi"); + unitString = QLatin1String("mi"); factor = 1609344.0; } else { // bigger then 1000 mi -> scientific notation - unitString = QString::fromLatin1("in"); + unitString = QLatin1String("in"); factor = 25.4; } } @@ -84,41 +84,41 @@ UnitsSchemaImperial1::schemaTranslate(const Quantity& quant, double& factor, QSt else if (unit == Unit::Area) { // TODO: Cascade for the Areas // default action for all cases without special treatment: - unitString = QString::fromLatin1("in^2"); + unitString = QLatin1String("in^2"); factor = 645.16; } else if (unit == Unit::Volume) { // TODO: Cascade for the Volume // default action for all cases without special treatment: - unitString = QString::fromLatin1("in^3"); + unitString = QLatin1String("in^3"); factor = 16387.064; } else if (unit == Unit::Mass) { // TODO: Cascade for the weights // default action for all cases without special treatment: - unitString = QString::fromLatin1("lb"); + unitString = QLatin1String("lb"); factor = 0.45359237; } else if (unit == Unit::Pressure) { if (UnitValue < 6894.744) { // psi is the smallest - unitString = QString::fromLatin1("psi"); + unitString = QLatin1String("psi"); factor = 6.894744825494; } else if (UnitValue < 6894744.825) { - unitString = QString::fromLatin1("ksi"); + unitString = QLatin1String("ksi"); factor = 6894.744825494; } else { // bigger then 1000 ksi -> psi + scientific notation - unitString = QString::fromLatin1("psi"); + unitString = QLatin1String("psi"); factor = 6.894744825494; } } else if (unit == Unit::Stiffness) { // Conversion to lbf/in - unitString = QString::fromLatin1("lbf/in"); + unitString = QLatin1String("lbf/in"); factor = 4.448222 / 0.0254; } else if (unit == Unit::Velocity) { - unitString = QString::fromLatin1("in/min"); + unitString = QLatin1String("in/min"); factor = 25.4 / 60; } else { @@ -141,7 +141,7 @@ QString UnitsSchemaImperialDecimal::schemaTranslate(const Base::Quantity& quant, // now do special treatment on all cases seems necessary: if (unit == Unit::Length) { // Length handling ============================ - unitString = QString::fromLatin1("in"); + unitString = QLatin1String("in"); factor = 25.4; } else if (unit == Unit::Angle) { @@ -151,35 +151,35 @@ QString UnitsSchemaImperialDecimal::schemaTranslate(const Base::Quantity& quant, else if (unit == Unit::Area) { // TODO: Cascade for the Areas // default action for all cases without special treatment: - unitString = QString::fromLatin1("in^2"); + unitString = QLatin1String("in^2"); factor = 645.16; } else if (unit == Unit::Volume) { // TODO: Cascade for the Volume // default action for all cases without special treatment: - unitString = QString::fromLatin1("in^3"); + unitString = QLatin1String("in^3"); factor = 16387.064; } else if (unit == Unit::Mass) { // TODO: Cascade for the weights // default action for all cases without special treatment: - unitString = QString::fromLatin1("lb"); + unitString = QLatin1String("lb"); factor = 0.45359237; } else if (unit == Unit::Pressure) { - unitString = QString::fromLatin1("psi"); + unitString = QLatin1String("psi"); factor = 6.894744825494; } else if (unit == Unit::Stiffness) { - unitString = QString::fromLatin1("lbf/in"); + unitString = QLatin1String("lbf/in"); factor = 4.448222 / 0.0254; } else if (unit == Unit::Velocity) { - unitString = QString::fromLatin1("in/min"); + unitString = QLatin1String("in/min"); factor = 25.4 / 60; } else if (unit == Unit::Acceleration) { - unitString = QString::fromLatin1("in/min^2"); + unitString = QLatin1String("in/min^2"); factor = 25.4 / 3600; } else { @@ -199,7 +199,7 @@ QString UnitsSchemaImperialBuilding::schemaTranslate(const Quantity& quant, // ex: 3'- 4 1/4" with proper rounding Unit unit = quant.getUnit(); if (unit == Unit::Length) { - unitString = QString::fromLatin1("in"); + unitString = QLatin1String("in"); factor = 25.4; // Total number of inches to format @@ -227,7 +227,7 @@ QString UnitsSchemaImperialBuilding::schemaTranslate(const Quantity& quant, // If this is zero, nothing to do but return if (ntot == 0) { - return QString::fromLatin1("0"); + return QLatin1String("0"); } // Compute the whole number of feet and remaining units @@ -300,15 +300,15 @@ QString UnitsSchemaImperialBuilding::schemaTranslate(const Quantity& quant, factor = 1.0; } else if (unit == Unit::Area) { - unitString = QString::fromLatin1("sqft"); + unitString = QLatin1String("sqft"); factor = 92903.04; } else if (unit == Unit::Volume) { - unitString = QString::fromLatin1("cft"); + unitString = QLatin1String("cft"); factor = 28316846.592; } else if (unit == Unit::Velocity) { - unitString = QString::fromLatin1("in/min"); + unitString = QLatin1String("in/min"); factor = 25.4 / 60; } else { @@ -330,27 +330,27 @@ QString UnitsSchemaImperialCivil::schemaTranslate(const Base::Quantity& quant, // now do special treatment on all cases seems necessary: if (unit == Unit::Length) { // Length handling ============================ - unitString = QString::fromLatin1("ft"); // always ft + unitString = QLatin1String("ft"); // always ft factor = 304.8; // 12 * 25.4 } else if (unit == Unit::Area) { - unitString = QString::fromLatin1("ft^2"); // always sq.ft + unitString = QLatin1String("ft^2"); // always sq.ft factor = 92903.04; } else if (unit == Unit::Volume) { - unitString = QString::fromLatin1("ft^3"); // always cu. ft + unitString = QLatin1String("ft^3"); // always cu. ft factor = 28316846.592; } else if (unit == Unit::Mass) { - unitString = QString::fromLatin1("lb"); // always lbs. + unitString = QLatin1String("lb"); // always lbs. factor = 0.45359237; } else if (unit == Unit::Pressure) { - unitString = QString::fromLatin1("psi"); + unitString = QLatin1String("psi"); factor = 6.894744825494; } else if (unit == Unit::Stiffness) { - unitString = QString::fromLatin1("lbf/in"); + unitString = QLatin1String("lbf/in"); factor = 4.448222 / 0.0254; } else if (unit == Unit::Velocity) { diff --git a/src/Base/UnitsSchemaInternal.cpp b/src/Base/UnitsSchemaInternal.cpp index 4b141fd2470d..a5131825b689 100644 --- a/src/Base/UnitsSchemaInternal.cpp +++ b/src/Base/UnitsSchemaInternal.cpp @@ -52,11 +52,11 @@ UnitsSchemaInternal::schemaTranslate(const Quantity& quant, double& factor, QStr // now do special treatment on all cases seems necessary: if (unit == Unit::Length) { // Length handling ============================ if (UnitValue < 1e-6) { // smaller than 0.001 nm -> scientific notation - unitString = QString::fromLatin1("mm"); + unitString = QLatin1String("mm"); factor = 1.0; } else if (UnitValue < 1e-3) { - unitString = QString::fromLatin1("nm"); + unitString = QLatin1String("nm"); factor = 1e-6; } else if (UnitValue < 0.1) { @@ -64,55 +64,55 @@ UnitsSchemaInternal::schemaTranslate(const Quantity& quant, double& factor, QStr factor = 1e-3; } else if (UnitValue < 1e4) { - unitString = QString::fromLatin1("mm"); + unitString = QLatin1String("mm"); factor = 1.0; } else if (UnitValue < 1e7) { - unitString = QString::fromLatin1("m"); + unitString = QLatin1String("m"); factor = 1e3; } else if (UnitValue < 1e10) { - unitString = QString::fromLatin1("km"); + unitString = QLatin1String("km"); factor = 1e6; } else { // bigger than 1000 km -> scientific notation - unitString = QString::fromLatin1("m"); + unitString = QLatin1String("m"); factor = 1e3; } } else if (unit == Unit::Area) { if (UnitValue < 100) { - unitString = QString::fromLatin1("mm^2"); + unitString = QLatin1String("mm^2"); factor = 1.0; } else if (UnitValue < 1e6) { - unitString = QString::fromLatin1("cm^2"); + unitString = QLatin1String("cm^2"); factor = 100; } else if (UnitValue < 1e12) { - unitString = QString::fromLatin1("m^2"); + unitString = QLatin1String("m^2"); factor = 1e6; } else { // bigger than 1 square kilometer - unitString = QString::fromLatin1("km^2"); + unitString = QLatin1String("km^2"); factor = 1e12; } } else if (unit == Unit::Volume) { if (UnitValue < 1e3) { // smaller than 1 ul - unitString = QString::fromLatin1("mm^3"); + unitString = QLatin1String("mm^3"); factor = 1.0; } else if (UnitValue < 1e6) { - unitString = QString::fromLatin1("ml"); + unitString = QLatin1String("ml"); factor = 1e3; } else if (UnitValue < 1e9) { - unitString = QString::fromLatin1("l"); + unitString = QLatin1String("l"); factor = 1e6; } else { // bigger than 1000 l - unitString = QString::fromLatin1("m^3"); + unitString = QLatin1String("m^3"); factor = 1e9; } } @@ -128,43 +128,43 @@ UnitsSchemaInternal::schemaTranslate(const Quantity& quant, double& factor, QStr factor = 1e-9; } else if (UnitValue < 1e-3) { - unitString = QString::fromLatin1("mg"); + unitString = QLatin1String("mg"); factor = 1e-6; } else if (UnitValue < 1.0) { - unitString = QString::fromLatin1("g"); + unitString = QLatin1String("g"); factor = 1e-3; } else if (UnitValue < 1e3) { - unitString = QString::fromLatin1("kg"); + unitString = QLatin1String("kg"); factor = 1.0; } else { - unitString = QString::fromLatin1("t"); + unitString = QLatin1String("t"); factor = 1e3; } } else if (unit == Unit::Density) { if (UnitValue < 0.0001) { - unitString = QString::fromLatin1("kg/m^3"); + unitString = QLatin1String("kg/m^3"); factor = 1e-9; } else if (UnitValue < 1.0) { - unitString = QString::fromLatin1("kg/cm^3"); + unitString = QLatin1String("kg/cm^3"); factor = 0.001; } else { - unitString = QString::fromLatin1("kg/mm^3"); + unitString = QLatin1String("kg/mm^3"); factor = 1.0; } } else if (unit == Unit::ThermalConductivity) { if (UnitValue > 1e6) { - unitString = QString::fromLatin1("W/mm/K"); + unitString = QLatin1String("W/mm/K"); factor = 1e6; } else { - unitString = QString::fromLatin1("W/m/K"); + unitString = QLatin1String("W/m/K"); factor = 1000.0; } } @@ -174,7 +174,7 @@ UnitsSchemaInternal::schemaTranslate(const Quantity& quant, double& factor, QStr factor = 1e-6; } else { - unitString = QString::fromLatin1("mm/mm/K"); + unitString = QLatin1String("mm/mm/K"); factor = 1.0; } } @@ -184,220 +184,220 @@ UnitsSchemaInternal::schemaTranslate(const Quantity& quant, double& factor, QStr factor = 1e-9; } else { - unitString = QString::fromLatin1("m^3/m^3/K"); + unitString = QLatin1String("m^3/m^3/K"); factor = 1.0; } } else if (unit == Unit::SpecificHeat) { - unitString = QString::fromLatin1("J/kg/K"); + unitString = QLatin1String("J/kg/K"); factor = 1e6; } else if (unit == Unit::ThermalTransferCoefficient) { - unitString = QString::fromLatin1("W/m^2/K"); + unitString = QLatin1String("W/m^2/K"); factor = 1.0; } else if ((unit == Unit::Pressure) || (unit == Unit::Stress)) { if (UnitValue < 10.0) { // Pa is the smallest - unitString = QString::fromLatin1("Pa"); + unitString = QLatin1String("Pa"); factor = 0.001; } else if (UnitValue < 10000.0) { - unitString = QString::fromLatin1("kPa"); + unitString = QLatin1String("kPa"); factor = 1.0; } else if (UnitValue < 10000000.0) { - unitString = QString::fromLatin1("MPa"); + unitString = QLatin1String("MPa"); factor = 1000.0; } else if (UnitValue < 10000000000.0) { - unitString = QString::fromLatin1("GPa"); + unitString = QLatin1String("GPa"); factor = 1e6; } else { // bigger -> scientific notation - unitString = QString::fromLatin1("Pa"); + unitString = QLatin1String("Pa"); factor = 0.001; } } else if ((unit == Unit::Stiffness)) { if (UnitValue < 1) { // mN/m is the smallest - unitString = QString::fromLatin1("mN/m"); + unitString = QLatin1String("mN/m"); factor = 1e-3; } else if (UnitValue < 1e3) { - unitString = QString::fromLatin1("N/m"); + unitString = QLatin1String("N/m"); factor = 1.0; } else if (UnitValue < 1e6) { - unitString = QString::fromLatin1("kN/m"); + unitString = QLatin1String("kN/m"); factor = 1e3; } else { - unitString = QString::fromLatin1("MN/m"); + unitString = QLatin1String("MN/m"); factor = 1e6; } } else if ((unit == Unit::StiffnessDensity)) { if (UnitValue < 1e-3) { - unitString = QString::fromLatin1("Pa/m"); + unitString = QLatin1String("Pa/m"); factor = 1e-6; } else if (UnitValue < 1) { - unitString = QString::fromLatin1("kPa/m"); + unitString = QLatin1String("kPa/m"); factor = 1e-3; } else if (UnitValue < 1e3) { - unitString = QString::fromLatin1("MPa/m"); + unitString = QLatin1String("MPa/m"); factor = 1.0; } else { - unitString = QString::fromLatin1("GPa/m"); + unitString = QLatin1String("GPa/m"); factor = 1e3; } } else if (unit == Unit::Force) { if (UnitValue < 1e3) { - unitString = QString::fromLatin1("mN"); + unitString = QLatin1String("mN"); factor = 1.0; } else if (UnitValue < 1e6) { - unitString = QString::fromLatin1("N"); + unitString = QLatin1String("N"); factor = 1e3; } else if (UnitValue < 1e9) { - unitString = QString::fromLatin1("kN"); + unitString = QLatin1String("kN"); factor = 1e6; } else { - unitString = QString::fromLatin1("MN"); + unitString = QLatin1String("MN"); factor = 1e9; } } // else if (unit == Unit::Moment) { // if (UnitValue < 1e6) { - // unitString = QString::fromLatin1("mNm"); + // unitString = QLatin1String("mNm"); // factor = 1e3; // } // else if (UnitValue < 1e9) { - // unitString = QString::fromLatin1("Nm"); + // unitString = QLatin1String("Nm"); // factor = 1e6; // } // else if (UnitValue < 1e12) { - // unitString = QString::fromLatin1("kNm"); + // unitString = QLatin1String("kNm"); // factor = 1e9; // } // else { - // unitString = QString::fromLatin1("MNm"); + // unitString = QLatin1String("MNm"); // factor = 1e12; // } // } else if (unit == Unit::Power) { if (UnitValue < 1e6) { - unitString = QString::fromLatin1("mW"); + unitString = QLatin1String("mW"); factor = 1e3; } else if (UnitValue < 1e9) { - unitString = QString::fromLatin1("W"); + unitString = QLatin1String("W"); factor = 1e6; } else { - unitString = QString::fromLatin1("kW"); + unitString = QLatin1String("kW"); factor = 1e9; } } else if (unit == Unit::ElectricPotential) { if (UnitValue < 1e6) { - unitString = QString::fromLatin1("mV"); + unitString = QLatin1String("mV"); factor = 1e3; } else if (UnitValue < 1e9) { - unitString = QString::fromLatin1("V"); + unitString = QLatin1String("V"); factor = 1e6; } else if (UnitValue < 1e12) { - unitString = QString::fromLatin1("kV"); + unitString = QLatin1String("kV"); factor = 1e9; } else { // > 1000 kV scientificc notation - unitString = QString::fromLatin1("V"); + unitString = QLatin1String("V"); factor = 1e6; } } else if (unit == Unit::Work) { if (UnitValue < 1.602176634e-10) { - unitString = QString::fromLatin1("eV"); + unitString = QLatin1String("eV"); factor = 1.602176634e-13; } else if (UnitValue < 1.602176634e-7) { - unitString = QString::fromLatin1("keV"); + unitString = QLatin1String("keV"); factor = 1.602176634e-10; } else if (UnitValue < 1.602176634e-4) { - unitString = QString::fromLatin1("MeV"); + unitString = QLatin1String("MeV"); factor = 1.602176634e-7; } else if (UnitValue < 1e6) { - unitString = QString::fromLatin1("mJ"); + unitString = QLatin1String("mJ"); factor = 1e3; } else if (UnitValue < 1e9) { - unitString = QString::fromLatin1("J"); + unitString = QLatin1String("J"); factor = 1e6; } else if (UnitValue < 1e12) { - unitString = QString::fromLatin1("kJ"); + unitString = QLatin1String("kJ"); factor = 1e9; } else if (UnitValue < 3.6e+15) { - unitString = QString::fromLatin1("kWh"); + unitString = QLatin1String("kWh"); factor = 3.6e+12; } else { // bigger than 1000 kWh -> scientific notation - unitString = QString::fromLatin1("J"); + unitString = QLatin1String("J"); factor = 1e6; } } else if (unit == Unit::SpecificEnergy) { - unitString = QString::fromLatin1("m^2/s^2"); + unitString = QLatin1String("m^2/s^2"); factor = 1e6; } else if (unit == Unit::HeatFlux) { - unitString = QString::fromLatin1("W/m^2"); + unitString = QLatin1String("W/m^2"); factor = 1; // unit signature (0,1,-3,0,0) is length independent } else if (unit == Unit::ElectricCharge) { - unitString = QString::fromLatin1("C"); + unitString = QLatin1String("C"); factor = 1.0; } else if (unit == Unit::CurrentDensity) { if (UnitValue <= 1e3) { - unitString = QString::fromLatin1("A/m^2"); + unitString = QLatin1String("A/m^2"); factor = 1e-6; } else { - unitString = QString::fromLatin1("A/mm^2"); + unitString = QLatin1String("A/mm^2"); factor = 1; } } else if (unit == Unit::MagneticFluxDensity) { if (UnitValue <= 1e-3) { - unitString = QString::fromLatin1("G"); + unitString = QLatin1String("G"); factor = 1e-4; } else { - unitString = QString::fromLatin1("T"); + unitString = QLatin1String("T"); factor = 1.0; } } else if (unit == Unit::MagneticFieldStrength) { - unitString = QString::fromLatin1("A/m"); + unitString = QLatin1String("A/m"); factor = 1e-3; } else if (unit == Unit::MagneticFlux) { - unitString = QString::fromLatin1("Wb"); + unitString = QLatin1String("Wb"); factor = 1e6; } else if (unit == Unit::Magnetization) { - unitString = QString::fromLatin1("A/m"); + unitString = QLatin1String("A/m"); factor = 1e-3; } else if (unit == Unit::ElectricalConductance) { @@ -406,53 +406,53 @@ UnitsSchemaInternal::schemaTranslate(const Quantity& quant, double& factor, QStr factor = 1e-12; } else if (UnitValue < 1e-6) { - unitString = QString::fromLatin1("mS"); + unitString = QLatin1String("mS"); factor = 1e-9; } else { - unitString = QString::fromLatin1("S"); + unitString = QLatin1String("S"); factor = 1e-6; } } else if (unit == Unit::ElectricalResistance) { if (UnitValue < 1e9) { - unitString = QString::fromLatin1("Ohm"); + unitString = QLatin1String("Ohm"); factor = 1e6; } else if (UnitValue < 1e12) { - unitString = QString::fromLatin1("kOhm"); + unitString = QLatin1String("kOhm"); factor = 1e9; } else { - unitString = QString::fromLatin1("MOhm"); + unitString = QLatin1String("MOhm"); factor = 1e12; } } else if (unit == Unit::ElectricalConductivity) { if (UnitValue < 1e-3) { - unitString = QString::fromLatin1("mS/m"); + unitString = QLatin1String("mS/m"); factor = 1e-12; } else if (UnitValue < 1.0) { - unitString = QString::fromLatin1("S/m"); + unitString = QLatin1String("S/m"); factor = 1e-9; } else if (UnitValue < 1e3) { - unitString = QString::fromLatin1("kS/m"); + unitString = QLatin1String("kS/m"); factor = 1e-6; } else { - unitString = QString::fromLatin1("MS/m"); + unitString = QLatin1String("MS/m"); factor = 1e-3; } } else if (unit == Unit::ElectricalCapacitance) { if (UnitValue < 1e-15) { - unitString = QString::fromLatin1("pF"); + unitString = QLatin1String("pF"); factor = 1e-18; } else if (UnitValue < 1e-12) { - unitString = QString::fromLatin1("nF"); + unitString = QLatin1String("nF"); factor = 1e-15; } else if (UnitValue < 1e-9) { @@ -462,17 +462,17 @@ UnitsSchemaInternal::schemaTranslate(const Quantity& quant, double& factor, QStr factor = 1e-12; } else if (UnitValue < 1e-6) { - unitString = QString::fromLatin1("mF"); + unitString = QLatin1String("mF"); factor = 1e-9; } else { - unitString = QString::fromLatin1("F"); + unitString = QLatin1String("F"); factor = 1e-6; } } else if (unit == Unit::ElectricalInductance) { if (UnitValue < 1.0) { - unitString = QString::fromLatin1("nH"); + unitString = QLatin1String("nH"); factor = 1e-3; } else if (UnitValue < 1e3) { @@ -480,95 +480,95 @@ UnitsSchemaInternal::schemaTranslate(const Quantity& quant, double& factor, QStr factor = 1.0; } else if (UnitValue < 1e6) { - unitString = QString::fromLatin1("mH"); + unitString = QLatin1String("mH"); factor = 1e3; } else { - unitString = QString::fromLatin1("H"); + unitString = QLatin1String("H"); factor = 1e6; } } else if (unit == Unit::VacuumPermittivity) { - unitString = QString::fromLatin1("F/m"); + unitString = QLatin1String("F/m"); factor = 1e-9; } else if (unit == Unit::Frequency) { if (UnitValue < 1e3) { - unitString = QString::fromLatin1("Hz"); + unitString = QLatin1String("Hz"); factor = 1.0; } else if (UnitValue < 1e6) { - unitString = QString::fromLatin1("kHz"); + unitString = QLatin1String("kHz"); factor = 1e3; } else if (UnitValue < 1e9) { - unitString = QString::fromLatin1("MHz"); + unitString = QLatin1String("MHz"); factor = 1e6; } else if (UnitValue < 1e12) { - unitString = QString::fromLatin1("GHz"); + unitString = QLatin1String("GHz"); factor = 1e9; } else { - unitString = QString::fromLatin1("THz"); + unitString = QLatin1String("THz"); factor = 1e12; } } else if (unit == Unit::Velocity) { - unitString = QString::fromLatin1("mm/s"); + unitString = QLatin1String("mm/s"); factor = 1.0; } else if (unit == Unit::DynamicViscosity) { - unitString = QString::fromLatin1("Pa*s"); + unitString = QLatin1String("Pa*s"); factor = 0.001; } else if (unit == Unit::KinematicViscosity) { if (UnitValue < 1e3) { - unitString = QString::fromLatin1("mm^2/s"); + unitString = QLatin1String("mm^2/s"); factor = 1.0; } else { - unitString = QString::fromLatin1("m^2/s"); + unitString = QLatin1String("m^2/s"); factor = 1e6; } } else if (unit == Unit::VolumeFlowRate) { if (UnitValue < 1e3) { - unitString = QString::fromLatin1("mm^3/s"); + unitString = QLatin1String("mm^3/s"); factor = 1.0; } else if (UnitValue < 1e6) { - unitString = QString::fromLatin1("ml/s"); + unitString = QLatin1String("ml/s"); factor = 1e3; } else if (UnitValue < 1e9) { - unitString = QString::fromLatin1("l/s"); + unitString = QLatin1String("l/s"); factor = 1e6; } else { - unitString = QString::fromLatin1("m^3/s"); + unitString = QLatin1String("m^3/s"); factor = 1e9; } } else if (unit == Unit::DissipationRate) { - unitString = QString::fromLatin1("m^2/s^3"); + unitString = QLatin1String("m^2/s^3"); factor = 1e6; } else if (unit == Unit::InverseLength) { if (UnitValue < 1e-6) { // smaller than 0.001 1/km -> scientific notation - unitString = QString::fromLatin1("1/m"); + unitString = QLatin1String("1/m"); factor = 1e-3; } else if (UnitValue < 1e-3) { - unitString = QString::fromLatin1("1/km"); + unitString = QLatin1String("1/km"); factor = 1e-6; } else if (UnitValue < 1.0) { - unitString = QString::fromLatin1("1/m"); + unitString = QLatin1String("1/m"); factor = 1e-3; } else if (UnitValue < 1e3) { - unitString = QString::fromLatin1("1/mm"); + unitString = QLatin1String("1/mm"); factor = 1.0; } else if (UnitValue < 1e6) { @@ -576,51 +576,51 @@ UnitsSchemaInternal::schemaTranslate(const Quantity& quant, double& factor, QStr factor = 1e3; } else if (UnitValue < 1e9) { - unitString = QString::fromLatin1("1/nm"); + unitString = QLatin1String("1/nm"); factor = 1e6; } else { // larger -> scientific notation - unitString = QString::fromLatin1("1/m"); + unitString = QLatin1String("1/m"); factor = 1e-3; } } else if (unit == Unit::InverseArea) { if (UnitValue < 1e-12) { // smaller than 0.001 1/km^2 -> scientific notation - unitString = QString::fromLatin1("1/m^2"); + unitString = QLatin1String("1/m^2"); factor = 1e-6; } else if (UnitValue < 1e-6) { - unitString = QString::fromLatin1("1/km^2"); + unitString = QLatin1String("1/km^2"); factor = 1e-12; } else if (UnitValue < 1.0) { - unitString = QString::fromLatin1("1/m^2"); + unitString = QLatin1String("1/m^2"); factor = 1e-6; } else if (UnitValue < 1e2) { - unitString = QString::fromLatin1("1/cm^2"); + unitString = QLatin1String("1/cm^2"); factor = 1e-2; } else { - unitString = QString::fromLatin1("1/mm^2"); + unitString = QLatin1String("1/mm^2"); factor = 1.0; } } else if (unit == Unit::InverseVolume) { if (UnitValue < 1e-6) { - unitString = QString::fromLatin1("1/m^3"); + unitString = QLatin1String("1/m^3"); factor = 1e-9; } else if (UnitValue < 1e-3) { - unitString = QString::fromLatin1("1/l"); + unitString = QLatin1String("1/l"); factor = 1e-6; } else if (UnitValue < 1.0) { - unitString = QString::fromLatin1("1/ml"); + unitString = QLatin1String("1/ml"); factor = 1e-3; } else { - unitString = QString::fromLatin1("1/mm^3"); + unitString = QLatin1String("1/mm^3"); factor = 1.0; } } diff --git a/src/Base/UnitsSchemaMKS.cpp b/src/Base/UnitsSchemaMKS.cpp index 96034a949530..be571293d31c 100644 --- a/src/Base/UnitsSchemaMKS.cpp +++ b/src/Base/UnitsSchemaMKS.cpp @@ -43,11 +43,11 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity& quant, double& factor, Q // now do special treatment on all cases seems necessary: if (unit == Unit::Length) { // Length handling ============================ if (UnitValue < 1e-6) { // smaller than 0.001 nm -> scientific notation - unitString = QString::fromLatin1("mm"); + unitString = QLatin1String("mm"); factor = 1.0; } else if (UnitValue < 1e-3) { - unitString = QString::fromLatin1("nm"); + unitString = QLatin1String("nm"); factor = 1e-6; } else if (UnitValue < 0.1) { @@ -55,55 +55,55 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity& quant, double& factor, Q factor = 1e-3; } else if (UnitValue < 1e4) { - unitString = QString::fromLatin1("mm"); + unitString = QLatin1String("mm"); factor = 1.0; } else if (UnitValue < 1e7) { - unitString = QString::fromLatin1("m"); + unitString = QLatin1String("m"); factor = 1e3; } else if (UnitValue < 1e10) { - unitString = QString::fromLatin1("km"); + unitString = QLatin1String("km"); factor = 1e6; } else { // bigger than 1000 km -> scientific notation - unitString = QString::fromLatin1("m"); + unitString = QLatin1String("m"); factor = 1e3; } } else if (unit == Unit::Area) { if (UnitValue < 100) { - unitString = QString::fromLatin1("mm^2"); + unitString = QLatin1String("mm^2"); factor = 1.0; } else if (UnitValue < 1e6) { - unitString = QString::fromLatin1("cm^2"); + unitString = QLatin1String("cm^2"); factor = 100; } else if (UnitValue < 1e12) { - unitString = QString::fromLatin1("m^2"); + unitString = QLatin1String("m^2"); factor = 1e6; } else { // bigger than 1 square kilometer - unitString = QString::fromLatin1("km^2"); + unitString = QLatin1String("km^2"); factor = 1e12; } } else if (unit == Unit::Volume) { if (UnitValue < 1e3) { // smaller than 1 ul - unitString = QString::fromLatin1("mm^3"); + unitString = QLatin1String("mm^3"); factor = 1.0; } else if (UnitValue < 1e6) { - unitString = QString::fromLatin1("ml"); + unitString = QLatin1String("ml"); factor = 1e3; } else if (UnitValue < 1e9) { - unitString = QString::fromLatin1("l"); + unitString = QLatin1String("l"); factor = 1e6; } else { // bigger than 1000 l - unitString = QString::fromLatin1("m^3"); + unitString = QLatin1String("m^3"); factor = 1e9; } } @@ -113,105 +113,105 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity& quant, double& factor, Q factor = 1e-9; } else if (UnitValue < 1e-3) { - unitString = QString::fromLatin1("mg"); + unitString = QLatin1String("mg"); factor = 1e-6; } else if (UnitValue < 1.0) { - unitString = QString::fromLatin1("g"); + unitString = QLatin1String("g"); factor = 1e-3; } else if (UnitValue < 1e3) { - unitString = QString::fromLatin1("kg"); + unitString = QLatin1String("kg"); factor = 1.0; } else { - unitString = QString::fromLatin1("t"); + unitString = QLatin1String("t"); factor = 1e3; } } else if (unit == Unit::Density) { if (UnitValue < 0.0001) { - unitString = QString::fromLatin1("kg/m^3"); + unitString = QLatin1String("kg/m^3"); factor = 0.000000001; } else if (UnitValue < 1.0) { - unitString = QString::fromLatin1("kg/cm^3"); + unitString = QLatin1String("kg/cm^3"); factor = 0.001; } else { - unitString = QString::fromLatin1("kg/mm^3"); + unitString = QLatin1String("kg/mm^3"); factor = 1.0; } } else if (unit == Unit::Acceleration) { - unitString = QString::fromLatin1("m/s^2"); + unitString = QLatin1String("m/s^2"); factor = 1000.0; } else if ((unit == Unit::Pressure) || (unit == Unit::Stress)) { if (UnitValue < 10.0) { // Pa is the smallest - unitString = QString::fromLatin1("Pa"); + unitString = QLatin1String("Pa"); factor = 0.001; } else if (UnitValue < 10000.0) { - unitString = QString::fromLatin1("kPa"); + unitString = QLatin1String("kPa"); factor = 1.0; } else if (UnitValue < 10000000.0) { - unitString = QString::fromLatin1("MPa"); + unitString = QLatin1String("MPa"); factor = 1000.0; } else if (UnitValue < 10000000000.0) { - unitString = QString::fromLatin1("GPa"); + unitString = QLatin1String("GPa"); factor = 1000000.0; } else { // bigger then 1000 GPa -> scientific notation - unitString = QString::fromLatin1("Pa"); + unitString = QLatin1String("Pa"); factor = 0.001; } } else if ((unit == Unit::Stiffness)) { if (UnitValue < 1) { // mN/m is the smallest - unitString = QString::fromLatin1("mN/m"); + unitString = QLatin1String("mN/m"); factor = 1e-3; } else if (UnitValue < 1e3) { - unitString = QString::fromLatin1("N/m"); + unitString = QLatin1String("N/m"); factor = 1.0; } else if (UnitValue < 1e6) { - unitString = QString::fromLatin1("kN/m"); + unitString = QLatin1String("kN/m"); factor = 1e3; } else { - unitString = QString::fromLatin1("MN/m"); + unitString = QLatin1String("MN/m"); factor = 1e6; } } else if ((unit == Unit::StiffnessDensity)) { if (UnitValue < 1e-3) { - unitString = QString::fromLatin1("Pa/m"); + unitString = QLatin1String("Pa/m"); factor = 1e-6; } else if (UnitValue < 1) { - unitString = QString::fromLatin1("kPa/m"); + unitString = QLatin1String("kPa/m"); factor = 1e-3; } else if (UnitValue < 1e3) { - unitString = QString::fromLatin1("MPa/m"); + unitString = QLatin1String("MPa/m"); factor = 1.0; } else { - unitString = QString::fromLatin1("GPa/m"); + unitString = QLatin1String("GPa/m"); factor = 1e3; } } else if (unit == Unit::ThermalConductivity) { if (UnitValue > 1000000) { - unitString = QString::fromLatin1("W/mm/K"); + unitString = QLatin1String("W/mm/K"); factor = 1000000.0; } else { - unitString = QString::fromLatin1("W/m/K"); + unitString = QLatin1String("W/m/K"); factor = 1000.0; } } @@ -221,7 +221,7 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity& quant, double& factor, Q factor = 0.000001; } else { - unitString = QString::fromLatin1("m/m/K"); + unitString = QLatin1String("m/m/K"); factor = 1.0; } } @@ -231,120 +231,120 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity& quant, double& factor, Q factor = 1e-9; } else { - unitString = QString::fromLatin1("m^3/m^3/K"); + unitString = QLatin1String("m^3/m^3/K"); factor = 1.0; } } else if (unit == Unit::SpecificHeat) { - unitString = QString::fromLatin1("J/kg/K"); + unitString = QLatin1String("J/kg/K"); factor = 1000000.0; } else if (unit == Unit::ThermalTransferCoefficient) { - unitString = QString::fromLatin1("W/m^2/K"); + unitString = QLatin1String("W/m^2/K"); factor = 1.0; } else if (unit == Unit::Force) { if (UnitValue < 1e3) { - unitString = QString::fromLatin1("mN"); + unitString = QLatin1String("mN"); factor = 1.0; } else if (UnitValue < 1e6) { - unitString = QString::fromLatin1("N"); + unitString = QLatin1String("N"); factor = 1e3; } else if (UnitValue < 1e9) { - unitString = QString::fromLatin1("kN"); + unitString = QLatin1String("kN"); factor = 1e6; } else { - unitString = QString::fromLatin1("MN"); + unitString = QLatin1String("MN"); factor = 1e9; } } // else if (unit == Unit::Moment) { // if (UnitValue < 1e6) { - // unitString = QString::fromLatin1("mNm"); + // unitString = QLatin1String("mNm"); // factor = 1e3; // } // else if (UnitValue < 1e9) { - // unitString = QString::fromLatin1("Nm"); + // unitString = QLatin1String("Nm"); // factor = 1e6; // } // else if (UnitValue < 1e12) { - // unitString = QString::fromLatin1("kNm"); + // unitString = QLatin1String("kNm"); // factor = 1e9; // } // else { - // unitString = QString::fromLatin1("MNm"); + // unitString = QLatin1String("MNm"); // factor = 1e12; // } // } else if (unit == Unit::Power) { if (UnitValue < 1e6) { - unitString = QString::fromLatin1("mW"); + unitString = QLatin1String("mW"); factor = 1e3; } else if (UnitValue < 1e9) { - unitString = QString::fromLatin1("W"); + unitString = QLatin1String("W"); factor = 1e6; } else { - unitString = QString::fromLatin1("kW"); + unitString = QLatin1String("kW"); factor = 1e9; } } else if (unit == Unit::ElectricPotential) { if (UnitValue < 1e6) { - unitString = QString::fromLatin1("mV"); + unitString = QLatin1String("mV"); factor = 1e3; } else if (UnitValue < 1e9) { - unitString = QString::fromLatin1("V"); + unitString = QLatin1String("V"); factor = 1e6; } else if (UnitValue < 1e12) { - unitString = QString::fromLatin1("kV"); + unitString = QLatin1String("kV"); factor = 1e9; } else { // > 1000 kV scientificc notation - unitString = QString::fromLatin1("V"); + unitString = QLatin1String("V"); factor = 1e6; } } else if (unit == Unit::ElectricCharge) { - unitString = QString::fromLatin1("C"); + unitString = QLatin1String("C"); factor = 1.0; } else if (unit == Unit::CurrentDensity) { if (UnitValue <= 1e3) { - unitString = QString::fromLatin1("A/m^2"); + unitString = QLatin1String("A/m^2"); factor = 1e-6; } else { - unitString = QString::fromLatin1("A/mm^2"); + unitString = QLatin1String("A/mm^2"); factor = 1; } } else if (unit == Unit::MagneticFluxDensity) { if (UnitValue <= 1e-3) { - unitString = QString::fromLatin1("G"); + unitString = QLatin1String("G"); factor = 1e-4; } else { - unitString = QString::fromLatin1("T"); + unitString = QLatin1String("T"); factor = 1.0; } } else if (unit == Unit::MagneticFieldStrength) { - unitString = QString::fromLatin1("A/m"); + unitString = QLatin1String("A/m"); factor = 1e-3; } else if (unit == Unit::MagneticFlux) { - unitString = QString::fromLatin1("Wb"); + unitString = QLatin1String("Wb"); factor = 1e6; } else if (unit == Unit::Magnetization) { - unitString = QString::fromLatin1("A/m"); + unitString = QLatin1String("A/m"); factor = 1e-3; } else if (unit == Unit::ElectricalConductance) { @@ -353,53 +353,53 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity& quant, double& factor, Q factor = 1e-12; } else if (UnitValue < 1e-6) { - unitString = QString::fromLatin1("mS"); + unitString = QLatin1String("mS"); factor = 1e-9; } else { - unitString = QString::fromLatin1("S"); + unitString = QLatin1String("S"); factor = 1e-6; } } else if (unit == Unit::ElectricalResistance) { if (UnitValue < 1e9) { - unitString = QString::fromLatin1("Ohm"); + unitString = QLatin1String("Ohm"); factor = 1e6; } else if (UnitValue < 1e12) { - unitString = QString::fromLatin1("kOhm"); + unitString = QLatin1String("kOhm"); factor = 1e9; } else { - unitString = QString::fromLatin1("MOhm"); + unitString = QLatin1String("MOhm"); factor = 1e12; } } else if (unit == Unit::ElectricalConductivity) { if (UnitValue < 1e-3) { - unitString = QString::fromLatin1("mS/m"); + unitString = QLatin1String("mS/m"); factor = 1e-12; } else if (UnitValue < 1.0) { - unitString = QString::fromLatin1("S/m"); + unitString = QLatin1String("S/m"); factor = 1e-9; } else if (UnitValue < 1e3) { - unitString = QString::fromLatin1("kS/m"); + unitString = QLatin1String("kS/m"); factor = 1e-6; } else { - unitString = QString::fromLatin1("MS/m"); + unitString = QLatin1String("MS/m"); factor = 1e-3; } } else if (unit == Unit::ElectricalCapacitance) { if (UnitValue < 1e-15) { - unitString = QString::fromLatin1("pF"); + unitString = QLatin1String("pF"); factor = 1e-18; } else if (UnitValue < 1e-12) { - unitString = QString::fromLatin1("nF"); + unitString = QLatin1String("nF"); factor = 1e-15; } else if (UnitValue < 1e-9) { @@ -409,17 +409,17 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity& quant, double& factor, Q factor = 1e-12; } else if (UnitValue < 1e-6) { - unitString = QString::fromLatin1("mF"); + unitString = QLatin1String("mF"); factor = 1e-9; } else { - unitString = QString::fromLatin1("F"); + unitString = QLatin1String("F"); factor = 1e-6; } } else if (unit == Unit::ElectricalInductance) { if (UnitValue < 1e-6) { - unitString = QString::fromLatin1("nH"); + unitString = QLatin1String("nH"); factor = 1e-3; } else if (UnitValue < 1e-3) { @@ -427,135 +427,135 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity& quant, double& factor, Q factor = 1.0; } else if (UnitValue < 1.0) { - unitString = QString::fromLatin1("mH"); + unitString = QLatin1String("mH"); factor = 1e3; } else { - unitString = QString::fromLatin1("H"); + unitString = QLatin1String("H"); factor = 1e6; } } else if (unit == Unit::VacuumPermittivity) { - unitString = QString::fromLatin1("F/m"); + unitString = QLatin1String("F/m"); factor = 1e-9; } else if (unit == Unit::Work) { if (UnitValue < 1.602176634e-10) { - unitString = QString::fromLatin1("eV"); + unitString = QLatin1String("eV"); factor = 1.602176634e-13; } else if (UnitValue < 1.602176634e-7) { - unitString = QString::fromLatin1("keV"); + unitString = QLatin1String("keV"); factor = 1.602176634e-10; } else if (UnitValue < 1.602176634e-4) { - unitString = QString::fromLatin1("MeV"); + unitString = QLatin1String("MeV"); factor = 1.602176634e-7; } else if (UnitValue < 1e6) { - unitString = QString::fromLatin1("mJ"); + unitString = QLatin1String("mJ"); factor = 1e3; } else if (UnitValue < 1e9) { - unitString = QString::fromLatin1("J"); + unitString = QLatin1String("J"); factor = 1e6; } else if (UnitValue < 1e12) { - unitString = QString::fromLatin1("kJ"); + unitString = QLatin1String("kJ"); factor = 1e9; } else if (UnitValue < 3.6e+15) { - unitString = QString::fromLatin1("kWh"); + unitString = QLatin1String("kWh"); factor = 3.6e+12; } else { // bigger than 1000 kWh -> scientific notation - unitString = QString::fromLatin1("J"); + unitString = QLatin1String("J"); factor = 1e6; } } else if (unit == Unit::SpecificEnergy) { - unitString = QString::fromLatin1("m^2/s^2"); + unitString = QLatin1String("m^2/s^2"); factor = 1000000; } else if (unit == Unit::HeatFlux) { - unitString = QString::fromLatin1("W/m^2"); + unitString = QLatin1String("W/m^2"); factor = 1.0; } else if (unit == Unit::Frequency) { if (UnitValue < 1e3) { - unitString = QString::fromLatin1("Hz"); + unitString = QLatin1String("Hz"); factor = 1.0; } else if (UnitValue < 1e6) { - unitString = QString::fromLatin1("kHz"); + unitString = QLatin1String("kHz"); factor = 1e3; } else if (UnitValue < 1e9) { - unitString = QString::fromLatin1("MHz"); + unitString = QLatin1String("MHz"); factor = 1e6; } else if (UnitValue < 1e12) { - unitString = QString::fromLatin1("GHz"); + unitString = QLatin1String("GHz"); factor = 1e9; } else { - unitString = QString::fromLatin1("THz"); + unitString = QLatin1String("THz"); factor = 1e12; } } else if (unit == Unit::Velocity) { - unitString = QString::fromLatin1("m/s"); + unitString = QLatin1String("m/s"); factor = 1000.0; } else if (unit == Unit::DynamicViscosity) { - unitString = QString::fromLatin1("Pa*s"); + unitString = QLatin1String("Pa*s"); factor = 0.001; } else if (unit == Unit::KinematicViscosity) { - unitString = QString::fromLatin1("m^2/s"); + unitString = QLatin1String("m^2/s"); factor = 1e6; } else if (unit == Unit::VolumeFlowRate) { if (UnitValue < 1e-3) { // smaller than 0.001 mm^3/s -> scientific notation - unitString = QString::fromLatin1("m^3/s"); + unitString = QLatin1String("m^3/s"); factor = 1e9; } else if (UnitValue < 1e3) { - unitString = QString::fromLatin1("mm^3/s"); + unitString = QLatin1String("mm^3/s"); factor = 1.0; } else if (UnitValue < 1e6) { - unitString = QString::fromLatin1("ml/s"); + unitString = QLatin1String("ml/s"); factor = 1e3; } else if (UnitValue < 1e9) { - unitString = QString::fromLatin1("l/s"); + unitString = QLatin1String("l/s"); factor = 1e6; } else { - unitString = QString::fromLatin1("m^3/s"); + unitString = QLatin1String("m^3/s"); factor = 1e9; } } else if (unit == Unit::DissipationRate) { - unitString = QString::fromLatin1("m^2/s^3"); + unitString = QLatin1String("m^2/s^3"); factor = 1e6; } else if (unit == Unit::InverseLength) { if (UnitValue < 1e-6) { // smaller than 0.001 1/km -> scientific notation - unitString = QString::fromLatin1("1/m"); + unitString = QLatin1String("1/m"); factor = 1e-3; } else if (UnitValue < 1e-3) { - unitString = QString::fromLatin1("1/km"); + unitString = QLatin1String("1/km"); factor = 1e-6; } else if (UnitValue < 1.0) { - unitString = QString::fromLatin1("1/m"); + unitString = QLatin1String("1/m"); factor = 1e-3; } else if (UnitValue < 1e3) { - unitString = QString::fromLatin1("1/mm"); + unitString = QLatin1String("1/mm"); factor = 1.0; } else if (UnitValue < 1e6) { @@ -563,51 +563,51 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity& quant, double& factor, Q factor = 1e3; } else if (UnitValue < 1e9) { - unitString = QString::fromLatin1("1/nm"); + unitString = QLatin1String("1/nm"); factor = 1e6; } else { // larger -> scientific notation - unitString = QString::fromLatin1("1/m"); + unitString = QLatin1String("1/m"); factor = 1e-3; } } else if (unit == Unit::InverseArea) { if (UnitValue < 1e-12) { // smaller than 0.001 1/km^2 -> scientific notation - unitString = QString::fromLatin1("1/m^2"); + unitString = QLatin1String("1/m^2"); factor = 1e-6; } else if (UnitValue < 1e-6) { - unitString = QString::fromLatin1("1/km^2"); + unitString = QLatin1String("1/km^2"); factor = 1e-12; } else if (UnitValue < 1.0) { - unitString = QString::fromLatin1("1/m^2"); + unitString = QLatin1String("1/m^2"); factor = 1e-6; } else if (UnitValue < 1e2) { - unitString = QString::fromLatin1("1/cm^2"); + unitString = QLatin1String("1/cm^2"); factor = 1e-2; } else { - unitString = QString::fromLatin1("1/mm^2"); + unitString = QLatin1String("1/mm^2"); factor = 1.0; } } else if (unit == Unit::InverseVolume) { if (UnitValue < 1e-6) { - unitString = QString::fromLatin1("1/m^3"); + unitString = QLatin1String("1/m^3"); factor = 1e-9; } else if (UnitValue < 1e-3) { - unitString = QString::fromLatin1("1/l"); + unitString = QLatin1String("1/l"); factor = 1e-6; } else if (UnitValue < 1.0) { - unitString = QString::fromLatin1("1/ml"); + unitString = QLatin1String("1/ml"); factor = 1e-3; } else { - unitString = QString::fromLatin1("1/mm^3"); + unitString = QLatin1String("1/mm^3"); factor = 1.0; } } diff --git a/src/Base/UnitsSchemaMeterDecimal.cpp b/src/Base/UnitsSchemaMeterDecimal.cpp index c3cb27d5aeb0..7c10d36dc8d1 100644 --- a/src/Base/UnitsSchemaMeterDecimal.cpp +++ b/src/Base/UnitsSchemaMeterDecimal.cpp @@ -48,37 +48,37 @@ QString UnitsSchemaMeterDecimal::schemaTranslate(const Base::Quantity& quant, Unit unit = quant.getUnit(); if (unit == Unit::Length) { // all length units in metres - unitString = QString::fromLatin1("m"); + unitString = QLatin1String("m"); factor = 1e3; } else if (unit == Unit::Area) { // all area units in square meters - unitString = QString::fromLatin1("m^2"); + unitString = QLatin1String("m^2"); factor = 1e6; } else if (unit == Unit::Volume) { // all area units in cubic meters - unitString = QString::fromLatin1("m^3"); + unitString = QLatin1String("m^3"); factor = 1e9; } else if (unit == Unit::Power) { // watts - unitString = QString::fromLatin1("W"); + unitString = QLatin1String("W"); factor = 1000000; } else if (unit == Unit::ElectricPotential) { // volts - unitString = QString::fromLatin1("V"); + unitString = QLatin1String("V"); factor = 1000000; } else if (unit == Unit::HeatFlux) { // watts per square metre - unitString = QString::fromLatin1("W/m^2"); + unitString = QLatin1String("W/m^2"); factor = 1.0; } else if (unit == Unit::Velocity) { // metres per second - unitString = QString::fromLatin1("m/s"); + unitString = QLatin1String("m/s"); factor = 1e3; } else { diff --git a/src/Base/UnitsSchemaMmMin.cpp b/src/Base/UnitsSchemaMmMin.cpp index be3196361e40..723a6190e6c8 100644 --- a/src/Base/UnitsSchemaMmMin.cpp +++ b/src/Base/UnitsSchemaMmMin.cpp @@ -39,7 +39,7 @@ UnitsSchemaMmMin::schemaTranslate(const Quantity& quant, double& factor, QString { Unit unit = quant.getUnit(); if (unit == Unit::Length) { - unitString = QString::fromLatin1("mm"); + unitString = QLatin1String("mm"); factor = 1.0; } else if (unit == Unit::Angle) { @@ -47,7 +47,7 @@ UnitsSchemaMmMin::schemaTranslate(const Quantity& quant, double& factor, QString factor = 1.0; } else if (unit == Unit::Velocity) { - unitString = QString::fromLatin1("mm/min"); + unitString = QLatin1String("mm/min"); factor = 1. / 60.; } else { diff --git a/src/Gui/Action.cpp b/src/Gui/Action.cpp index 2cfad6e045f2..5cb2103ed8a2 100644 --- a/src/Gui/Action.cpp +++ b/src/Gui/Action.cpp @@ -231,13 +231,13 @@ QString Action::cleanTitle(const QString & title) { QString text(title); // Deal with QAction title mnemonic - static QRegularExpression re(QStringLiteral("&(.)")); - text.replace(re, QStringLiteral("\\1")); + static QRegularExpression re(QLatin1String("&(.)")); + text.replace(re, QLatin1String("\\1")); // Probably not a good idea to trim ending punctuation #if 0 // Trim line ending punctuation - static QRegularExpression rePunct(QStringLiteral("[[:punct:]]+$")); + static QRegularExpression rePunct(QLatin1String("[[:punct:]]+$")); text.replace(rePunct, QString()); #endif return text; @@ -371,12 +371,12 @@ QString Action::createToolTip(QString helpText, return tooltip + helpText + cmdName; } - tooltip += QStringLiteral( + tooltip += QLatin1String( "

"); // If the user supplied tooltip contains line break, we shall honour it. if (helpText.indexOf(QLatin1Char('\n')) >= 0) { - tooltip += helpText.toHtmlEscaped() + QStringLiteral("

") ; + tooltip += helpText.toHtmlEscaped() + QLatin1String("

") ; } else { // If not, try to end the non wrapping paragraph at some pre defined @@ -385,7 +385,7 @@ QString Action::createToolTip(QString helpText, QFontMetrics fm(font); int width = QtTools::horizontalAdvance(fm, helpText); if (width <= tipWidth) { - tooltip += helpText.toHtmlEscaped() + QStringLiteral("

") ; + tooltip += helpText.toHtmlEscaped() + QLatin1String("

") ; } else { int index = tipWidth / width * helpText.size(); @@ -396,7 +396,7 @@ QString Action::createToolTip(QString helpText, } } tooltip += helpText.left(index).toHtmlEscaped() - + QStringLiteral("

") + + QLatin1String("

") + helpText.right(helpText.size()-index).trimmed().toHtmlEscaped(); } } @@ -475,7 +475,7 @@ void ActionGroup::addTo(QWidget *widget) widget->addAction(action()); QToolButton* tb = widget->findChildren().constLast(); tb->setPopupMode(QToolButton::MenuButtonPopup); - tb->setObjectName(QStringLiteral("qt_toolbutton_menubutton")); + tb->setObjectName(QLatin1String("qt_toolbutton_menubutton")); QList acts = groupAction()->actions(); auto menu = new QMenu(tb); menu->addActions(acts); @@ -1067,11 +1067,11 @@ void RecentMacrosAction::setFiles(const QStringList& files) for (int index = 0; index < accel_col.size(); index++) { msgMain += QStringLiteral(" %1").arg(accel_col[index]); } - msgMain += QStringLiteral(" disabled because of conflicts with"); + msgMain += QLatin1String(" disabled because of conflicts with"); for (int index = 0; index < existingCommands.count(); index++) { msgMain += QStringLiteral(" %1").arg(existingCommands[index]); } - msgMain += QStringLiteral(" respectively.\nHint: In Preferences -> Python -> Macro ->" + msgMain += QLatin1String(" respectively.\nHint: In Preferences -> Python -> Macro ->" " Recent Macros menu -> Keyboard Modifiers this should be Ctrl+Shift+" " by default, if this is now blank then you should revert it back to" " Ctrl+Shift+ by pressing both keys at the same time."); diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index d803946189da..7d0990a99c91 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -2270,13 +2270,13 @@ QString Application::replaceVariablesInQss(QString qssText) //convert them to hex. //Note: the ulong contains alpha channels so 8 hex characters when we need 6 here. - QString accentColor1 = QStringLiteral("#%1").arg(longAccentColor1, 8, 16, QLatin1Char('0')).toUpper().mid(0, 7); - QString accentColor2 = QStringLiteral("#%1").arg(longAccentColor2, 8, 16, QLatin1Char('0')).toUpper().mid(0, 7); - QString accentColor3 = QStringLiteral("#%1").arg(longAccentColor3, 8, 16, QLatin1Char('0')).toUpper().mid(0, 7); + QString accentColor1 = QLatin1String("#%1").arg(longAccentColor1, 8, 16, QLatin1Char('0')).toUpper().mid(0, 7); + QString accentColor2 = QLatin1String("#%1").arg(longAccentColor2, 8, 16, QLatin1Char('0')).toUpper().mid(0, 7); + QString accentColor3 = QLatin1String("#%1").arg(longAccentColor3, 8, 16, QLatin1Char('0')).toUpper().mid(0, 7); - qssText = qssText.replace(QStringLiteral("@ThemeAccentColor1"), accentColor1); - qssText = qssText.replace(QStringLiteral("@ThemeAccentColor2"), accentColor2); - qssText = qssText.replace(QStringLiteral("@ThemeAccentColor3"), accentColor3); + qssText = qssText.replace(QLatin1String("@ThemeAccentColor1"), accentColor1); + qssText = qssText.replace(QLatin1String("@ThemeAccentColor2"), accentColor2); + qssText = qssText.replace(QLatin1String("@ThemeAccentColor3"), accentColor3); //Base::Console().Warning("%s\n", qssText.toStdString()); return qssText; diff --git a/src/Gui/BitmapFactory.cpp b/src/Gui/BitmapFactory.cpp index 2ff9fe9978fe..1e2d1059985a 100644 --- a/src/Gui/BitmapFactory.cpp +++ b/src/Gui/BitmapFactory.cpp @@ -74,10 +74,10 @@ BitmapFactoryInst& BitmapFactoryInst::instance() } _pcSingleton->addPath(path); } - _pcSingleton->addPath(QStringLiteral("%1/icons").arg(QString::fromStdString(App::Application::getHomePath()))); - _pcSingleton->addPath(QStringLiteral("%1/icons").arg(QString::fromStdString(App::Application::getUserAppDataDir()))); - _pcSingleton->addPath(QStringLiteral(":/icons/")); - _pcSingleton->addPath(QStringLiteral(":/Icons/")); + _pcSingleton->addPath(QLatin1String("%1/icons").arg(QString::fromStdString(App::Application::getHomePath()))); + _pcSingleton->addPath(QLatin1String("%1/icons").arg(QString::fromStdString(App::Application::getUserAppDataDir()))); + _pcSingleton->addPath(QLatin1String(":/icons/")); + _pcSingleton->addPath(QLatin1String(":/Icons/")); } return *_pcSingleton; @@ -113,22 +113,22 @@ void BitmapFactoryInst::restoreCustomPaths() void BitmapFactoryInst::addPath(const QString& path) { - QDir::addSearchPath(QStringLiteral("icons"), path); + QDir::addSearchPath(QLatin1String("icons"), path); } void BitmapFactoryInst::removePath(const QString& path) { - QStringList iconPaths = QDir::searchPaths(QStringLiteral("icons")); + QStringList iconPaths = QDir::searchPaths(QLatin1String("icons")); int pos = iconPaths.indexOf(path); if (pos != -1) { iconPaths.removeAt(pos); - QDir::setSearchPaths(QStringLiteral("icons"), iconPaths); + QDir::setSearchPaths(QLatin1String("icons"), iconPaths); } } QStringList BitmapFactoryInst::getPaths() const { - return QDir::searchPaths(QStringLiteral("icons")); + return QDir::searchPaths(QLatin1String("icons")); } QStringList BitmapFactoryInst::findIconFiles() const @@ -138,7 +138,7 @@ QStringList BitmapFactoryInst::findIconFiles() const for (QList::iterator it = formats.begin(); it != formats.end(); ++it) filters << QStringLiteral("*.%1").arg(QString::fromUtf8(*it).toLower()); - QStringList paths = QDir::searchPaths(QStringLiteral("icons")); + QStringList paths = QDir::searchPaths(QLatin1String("icons")); paths.removeDuplicates(); for (QStringList::Iterator pt = paths.begin(); pt != paths.end(); ++pt) { QDir d(*pt); @@ -232,7 +232,7 @@ QPixmap BitmapFactoryInst::pixmap(const char* name) const QList formats = QImageReader::supportedImageFormats(); formats.prepend("SVG"); // check first for SVG to use special import mechanism - QString fileName = QStringLiteral("icons:") + fn; + QString fileName = QLatin1String("icons:") + fn; if (!loadPixmap(fileName, icon)) { // Go through supported file formats for (QList::iterator fm = formats.begin(); fm != formats.end(); ++fm) { @@ -266,13 +266,13 @@ QPixmap BitmapFactoryInst::pixmapFromSvg(const char* name, const QSizeF& size, // try to find it in the 'icons' search paths if (iconPath.isEmpty()) { - QString fileName = QStringLiteral("icons:") + fn; + QString fileName = QLatin1String("icons:") + fn; QFileInfo fi(fileName); if (fi.exists()) { iconPath = fi.filePath(); } else { - fileName += QStringLiteral(".svg"); + fileName += QLatin1String(".svg"); fi.setFile(fileName); if (fi.exists()) { iconPath = fi.filePath(); @@ -308,8 +308,8 @@ QPixmap BitmapFactoryInst::pixmapFromSvg(const QByteArray& originalContents, con for ( const auto &colorToColor : colorMapping ) { ulong fromColor = colorToColor.first; ulong toColor = colorToColor.second; - QString fromColorString = QStringLiteral(":#%1;").arg(fromColor, 6, 16, QChar::fromLatin1('0')); - QString toColorString = QStringLiteral(":#%1;").arg(toColor, 6, 16, QChar::fromLatin1('0')); + QString fromColorString = QLatin1String(":#%1;").arg(fromColor, 6, 16, QChar::fromLatin1('0')); + QString toColorString = QLatin1String(":#%1;").arg(toColor, 6, 16, QChar::fromLatin1('0')); stringContents = stringContents.replace(fromColorString, toColorString); } QByteArray contents = stringContents.toUtf8(); diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp index 3f51ae46fb20..bf9725aa7fff 100644 --- a/src/Gui/Command.cpp +++ b/src/Gui/Command.cpp @@ -1079,7 +1079,7 @@ Action * GroupCommand::createAction() { for(auto &v : cmds) { if(!v.first) - pcAction->addAction(QStringLiteral(""))->setSeparator(true); + pcAction->addAction(QLatin1String(""))->setSeparator(true); else v.first->addToGroup(pcAction); } @@ -1175,7 +1175,7 @@ void MacroCommand::activated(int iMsg) d = QDir(QString::fromUtf8(cMacroPath.c_str())); } else { - QString dirstr = QString::fromStdString(App::Application::getHomePath()) + QStringLiteral("Macro"); + QString dirstr = QString::fromStdString(App::Application::getHomePath()) + QLatin1String("Macro"); d = QDir(dirstr); } diff --git a/src/Gui/CommandDoc.cpp b/src/Gui/CommandDoc.cpp index 91a163cf3849..bdaf651ed526 100644 --- a/src/Gui/CommandDoc.cpp +++ b/src/Gui/CommandDoc.cpp @@ -202,19 +202,19 @@ void StdCmdImport::activated(int iMsg) const char* supported = QT_TR_NOOP("Supported formats"); const char* allFiles = QT_TR_NOOP("All files (*.*)"); formatList = QObject::tr(supported); - formatList += QStringLiteral(" ("); + formatList += QLatin1String(" ("); std::vector filetypes = App::GetApplication().getImportTypes(); std::vector::const_iterator it; for (it=filetypes.begin();it != filetypes.end();++it) { if (*it != "FCStd") { // ignore the project file format - formatList += QStringLiteral(" *."); + formatList += QLatin1String(" *."); formatList += QString::fromUtf8(it->c_str()); } } - formatList += QStringLiteral(");;"); + formatList += QLatin1String(");;"); std::map FilterList = App::GetApplication().getImportFilters(); std::map::const_iterator jt; @@ -222,7 +222,7 @@ void StdCmdImport::activated(int iMsg) // ignore the project file format if (jt->first.find("(*.FCStd)") == std::string::npos) { formatList += QString::fromUtf8(jt->first.c_str()); - formatList += QStringLiteral(";;"); + formatList += QLatin1String(";;"); } } formatList += QObject::tr(allFiles); @@ -656,7 +656,7 @@ void StdCmdNew::activated(int iMsg) { Q_UNUSED(iMsg); QString cmd; - cmd = QStringLiteral("App.newDocument()"); + cmd = QLatin1String("App.newDocument()"); runCommand(Command::Doc,cmd.toUtf8()); doCommand(Command::Gui,"Gui.activeDocument().activeView().viewDefaultOrientation()"); @@ -1435,7 +1435,7 @@ void StdCmdDelete::activated(int iMsg) e.ReportException(); } catch (...) { QMessageBox::critical(getMainWindow(), QObject::tr("Delete failed"), - QStringLiteral("Unknown error")); + QLatin1String("Unknown error")); } commitCommand(); Gui::getMainWindow()->setUpdatesEnabled(true); diff --git a/src/Gui/CommandPyImp.cpp b/src/Gui/CommandPyImp.cpp index 779cce11b7d2..bc12aa6721a2 100644 --- a/src/Gui/CommandPyImp.cpp +++ b/src/Gui/CommandPyImp.cpp @@ -100,7 +100,7 @@ PyObject* CommandPy::listByShortcut(PyObject *args) for (Command* c : cmds) { Action* action = c->getAction(); if (action) { - QString spc = QStringLiteral(" "); + QString spc = QLatin1String(" "); if (Base::asBoolean(bIsRegularExp)) { QRegularExpression re(QString::fromUtf8(shortcut_to_find), QRegularExpression::CaseInsensitiveOption); if (!re.isValid()) { diff --git a/src/Gui/CommandStd.cpp b/src/Gui/CommandStd.cpp index 3080b9d39eb2..3b1e3c64da4d 100644 --- a/src/Gui/CommandStd.cpp +++ b/src/Gui/CommandStd.cpp @@ -483,7 +483,7 @@ StdCmdOnlineHelp::StdCmdOnlineHelp() void StdCmdOnlineHelp::activated(int iMsg) { Q_UNUSED(iMsg); - Gui::getMainWindow()->showDocumentation(QStringLiteral("Online_Help_Startpage")); + Gui::getMainWindow()->showDocumentation(QLatin1String("Online_Help_Startpage")); } //=========================================================================== diff --git a/src/Gui/CommandTest.cpp b/src/Gui/CommandTest.cpp index 00f3888803f2..625b4de8e79a 100644 --- a/src/Gui/CommandTest.cpp +++ b/src/Gui/CommandTest.cpp @@ -70,8 +70,8 @@ void Std_TestQM::activated(int iMsg) { Q_UNUSED(iMsg); QStringList files = QFileDialog::getOpenFileNames(getMainWindow(), - QStringLiteral("Test translation"), QString(), - QStringLiteral("Translation (*.qm)")); + QLatin1String("Test translation"), QString(), + QLatin1String("Translation (*.qm)")); if (!files.empty()) { Translator::instance()->activateLanguage("English"); QList i18n = qApp->findChildren(); diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index a0a67bae40cc..401fe5b18e17 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -342,19 +342,19 @@ Action * StdCmdFreezeViews::createAction() saveView->setWhatsThis(QString::fromUtf8(getWhatsThis())); QAction* loadView = pcAction->addAction(QObject::tr("Load views...")); loadView->setWhatsThis(QString::fromUtf8(getWhatsThis())); - pcAction->addAction(QStringLiteral(""))->setSeparator(true); + pcAction->addAction(QLatin1String(""))->setSeparator(true); freezeView = pcAction->addAction(QObject::tr("Freeze view")); freezeView->setShortcut(QString::fromUtf8(getAccel())); freezeView->setWhatsThis(QString::fromUtf8(getWhatsThis())); clearView = pcAction->addAction(QObject::tr("Clear views")); clearView->setWhatsThis(QString::fromUtf8(getWhatsThis())); - separator = pcAction->addAction(QStringLiteral("")); + separator = pcAction->addAction(QLatin1String("")); separator->setSeparator(true); offset = pcAction->actions().count(); // allow up to 50 views for (int i=0; iaddAction(QStringLiteral(""))->setVisible(false); + pcAction->addAction(QLatin1String(""))->setVisible(false); return pcAction; } @@ -443,11 +443,11 @@ void StdCmdFreezeViews::onSaveViews() // remove the first line because it's a comment like '#Inventor V2.1 ascii' QString viewPos; if (!data.isEmpty()) { - QStringList lines = data.split(QStringLiteral("\n")); + QStringList lines = data.split(QLatin1String("\n")); if (lines.size() > 1) { lines.pop_front(); } - viewPos = lines.join(QStringLiteral(" ")); + viewPos = lines.join(QLatin1String(" ")); } str << " \n"; @@ -503,19 +503,19 @@ void StdCmdFreezeViews::onRestoreViews() } bool ok; - int scheme = root.attribute(QStringLiteral("SchemaVersion")).toInt(&ok); + int scheme = root.attribute(QLatin1String("SchemaVersion")).toInt(&ok); if (!ok) return; // SchemeVersion "1" if (scheme == 1) { // read the views, ignore the attribute 'Count' - QDomElement child = root.firstChildElement(QStringLiteral("Views")); - QDomElement views = child.firstChildElement(QStringLiteral("Camera")); + QDomElement child = root.firstChildElement(QLatin1String("Views")); + QDomElement views = child.firstChildElement(QLatin1String("Camera")); QStringList cameras; while (!views.isNull()) { - QString setting = views.attribute(QStringLiteral("settings")); + QString setting = views.attribute(QLatin1String("settings")); cameras << setting; - views = views.nextSiblingElement(QStringLiteral("Camera")); + views = views.nextSiblingElement(QLatin1String("Camera")); } // use this rather than the attribute 'Count' because it could be @@ -671,43 +671,43 @@ Gui::Action * StdCmdDrawStyle::createAction() a0->setCheckable(true); a0->setIcon(BitmapFactory().iconFromTheme("DrawStyleAsIs")); a0->setChecked(true); - a0->setObjectName(QStringLiteral("Std_DrawStyleAsIs")); + a0->setObjectName(QLatin1String("Std_DrawStyleAsIs")); a0->setShortcut(QKeySequence(QString::fromUtf8("V,1"))); a0->setWhatsThis(QString::fromUtf8(getWhatsThis())); QAction* a1 = pcAction->addAction(QString()); a1->setCheckable(true); a1->setIcon(BitmapFactory().iconFromTheme("DrawStylePoints")); - a1->setObjectName(QStringLiteral("Std_DrawStylePoints")); + a1->setObjectName(QLatin1String("Std_DrawStylePoints")); a1->setShortcut(QKeySequence(QString::fromUtf8("V,2"))); a1->setWhatsThis(QString::fromUtf8(getWhatsThis())); QAction* a2 = pcAction->addAction(QString()); a2->setCheckable(true); a2->setIcon(BitmapFactory().iconFromTheme("DrawStyleWireFrame")); - a2->setObjectName(QStringLiteral("Std_DrawStyleWireframe")); + a2->setObjectName(QLatin1String("Std_DrawStyleWireframe")); a2->setShortcut(QKeySequence(QString::fromUtf8("V,3"))); a2->setWhatsThis(QString::fromUtf8(getWhatsThis())); QAction* a3 = pcAction->addAction(QString()); a3->setCheckable(true); a3->setIcon(BitmapFactory().iconFromTheme("DrawStyleHiddenLine")); - a3->setObjectName(QStringLiteral("Std_DrawStyleHiddenLine")); + a3->setObjectName(QLatin1String("Std_DrawStyleHiddenLine")); a3->setShortcut(QKeySequence(QString::fromUtf8("V,4"))); a3->setWhatsThis(QString::fromUtf8(getWhatsThis())); QAction* a4 = pcAction->addAction(QString()); a4->setCheckable(true); a4->setIcon(BitmapFactory().iconFromTheme("DrawStyleNoShading")); - a4->setObjectName(QStringLiteral("Std_DrawStyleNoShading")); + a4->setObjectName(QLatin1String("Std_DrawStyleNoShading")); a4->setShortcut(QKeySequence(QString::fromUtf8("V,5"))); a4->setWhatsThis(QString::fromUtf8(getWhatsThis())); QAction* a5 = pcAction->addAction(QString()); a5->setCheckable(true); a5->setIcon(BitmapFactory().iconFromTheme("DrawStyleShaded")); - a5->setObjectName(QStringLiteral("Std_DrawStyleShaded")); + a5->setObjectName(QLatin1String("Std_DrawStyleShaded")); a5->setShortcut(QKeySequence(QString::fromUtf8("V,6"))); a5->setWhatsThis(QString::fromUtf8(getWhatsThis())); QAction* a6 = pcAction->addAction(QString()); a6->setCheckable(true); a6->setIcon(BitmapFactory().iconFromTheme("DrawStyleFlatLines")); - a6->setObjectName(QStringLiteral("Std_DrawStyleFlatLines")); + a6->setObjectName(QLatin1String("Std_DrawStyleFlatLines")); a6->setShortcut(QKeySequence(QString::fromUtf8("V,7"))); a6->setWhatsThis(QString::fromUtf8(getWhatsThis())); @@ -2120,8 +2120,8 @@ void StdViewLoadImage::activated(int iMsg) QFileDialog dialog(Gui::getMainWindow()); dialog.setWindowTitle(QObject::tr("Choose an image file to open")); dialog.setMimeTypeFilters(mimeTypeFilters); - dialog.selectMimeTypeFilter(QStringLiteral("image/png")); - dialog.setDefaultSuffix(QStringLiteral("png")); + dialog.selectMimeTypeFilter(QLatin1String("image/png")); + dialog.setDefaultSuffix(QLatin1String("png")); dialog.setAcceptMode(QFileDialog::AcceptOpen); dialog.setOption(QFileDialog::DontUseNativeDialog); diff --git a/src/Gui/DAGView/DAGFilter.cpp b/src/Gui/DAGView/DAGFilter.cpp index e331d52d2e1d..99585c12ba9c 100644 --- a/src/Gui/DAGView/DAGFilter.cpp +++ b/src/Gui/DAGView/DAGFilter.cpp @@ -31,7 +31,7 @@ using namespace Gui; using namespace DAG; -FilterBase::FilterBase() : name(QStringLiteral("empty name")) +FilterBase::FilterBase() : name(QLatin1String("empty name")) { } diff --git a/src/Gui/DlgActionsImp.cpp b/src/Gui/DlgActionsImp.cpp index af74ac1ab38b..c0368fc9663a 100644 --- a/src/Gui/DlgActionsImp.cpp +++ b/src/Gui/DlgActionsImp.cpp @@ -66,12 +66,12 @@ DlgCustomActionsImp::DlgCustomActionsImp( QWidget* parent ) GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro") ->GetASCII("MacroPath",App::Application::getUserMacroDir().c_str()); - QDir d(QString::fromUtf8(cMacroPath.c_str()), QStringLiteral("*.FCMacro *.py")); + QDir d(QString::fromUtf8(cMacroPath.c_str()), QLatin1String("*.FCMacro *.py")); for (unsigned int i=0; iactionMacros->insertItem(0,d[i],QVariant(false)); QString systemMacroDirStr = QString::fromStdString(App::Application::getHomePath()) + QString::fromUtf8("Macro"); - d = QDir(systemMacroDirStr, QStringLiteral("*.FCMacro *.py")); + d = QDir(systemMacroDirStr, QLatin1String("*.FCMacro *.py")); if (d.exists()) { for (unsigned int i=0; iactionMacros->insertItem(0,d[i],QVariant(true)); diff --git a/src/Gui/DlgCheckableMessageBox.cpp b/src/Gui/DlgCheckableMessageBox.cpp index c9423c9865f8..bba0f37fb96b 100644 --- a/src/Gui/DlgCheckableMessageBox.cpp +++ b/src/Gui/DlgCheckableMessageBox.cpp @@ -44,7 +44,7 @@ namespace Gui { namespace Dialog { QByteArray toParamEntry(QString name) { - name.replace(QStringLiteral(" "), QStringLiteral("_")); + name.replace(QLatin1String(" "), QLatin1String("_")); return name.toUtf8(); } diff --git a/src/Gui/DlgCheckableMessageBox.h b/src/Gui/DlgCheckableMessageBox.h index 443bf54ba7d0..97fc694e82b7 100644 --- a/src/Gui/DlgCheckableMessageBox.h +++ b/src/Gui/DlgCheckableMessageBox.h @@ -104,11 +104,11 @@ class GuiExport DlgCheckableMessageBox : public QDialog /// It shows a dialog with header and message provided and a checkbox in check state with the message provided. /// It uses a parameter in path "User parameter:BaseApp/CheckMessages" derived from the header test, defaulting to false, /// to store the status of the checkbox, when the user exits the modal dialog. - static void showMessage(const QString& header, const QString& message, bool check = false, const QString& checkText = QStringLiteral("Don't show me again")); + static void showMessage(const QString& header, const QString& message, bool check = false, const QString& checkText = QLatin1String("Don't show me again")); /// Same as showMessage above, but it checks the specific preference path and parameter provided, defaulting to entryDefault value if the parameter is not present. static void showMessage(const QString& header, const QString& message, const QString& prefPath, const QString& paramEntry, bool entryDefault = false, - bool check = false, const QString& checkText = QStringLiteral("Don't show me again")); + bool check = false, const QString& checkText = QLatin1String("Don't show me again")); private Q_SLOTS: void slotClicked(QAbstractButton *b); diff --git a/src/Gui/DlgCustomizeImp.cpp b/src/Gui/DlgCustomizeImp.cpp index e93a88c1502e..9df7768efa6e 100644 --- a/src/Gui/DlgCustomizeImp.cpp +++ b/src/Gui/DlgCustomizeImp.cpp @@ -79,7 +79,7 @@ DlgCustomizeImp::DlgCustomizeImp(QWidget* parent, Qt::WindowFlags fl) customLayout->addLayout( layout, 1, 0 ); tabWidget = new QTabWidget( this ); - tabWidget->setObjectName(QStringLiteral("Gui__Dialog__TabWidget"));//so we can find it in DlgMacroExecuteImp + tabWidget->setObjectName(QLatin1String("Gui__Dialog__TabWidget"));//so we can find it in DlgMacroExecuteImp // make sure that pages are ready to create GetWidgetFactorySupplier(); diff --git a/src/Gui/DlgCustomizeSpaceball.cpp b/src/Gui/DlgCustomizeSpaceball.cpp index 2972b2f80ada..ac6f3355d75a 100644 --- a/src/Gui/DlgCustomizeSpaceball.cpp +++ b/src/Gui/DlgCustomizeSpaceball.cpp @@ -492,7 +492,7 @@ CommandNode* CommandModel::nodeFromIndex(const QModelIndex &index) const void CommandModel::goAddMacro(const QByteArray ¯oName) { - QModelIndexList indexList(this->match(this->index(0,0), Qt::UserRole, QVariant(QStringLiteral("Macros")), + QModelIndexList indexList(this->match(this->index(0,0), Qt::UserRole, QVariant(QLatin1String("Macros")), 1, Qt::MatchWrap | Qt::MatchRecursive)); QModelIndex macrosIndex; if (indexList.empty()) @@ -500,7 +500,7 @@ void CommandModel::goAddMacro(const QByteArray ¯oName) //this is the first macro and we have to add the Macros item. //figure out where to insert it. Should be in the command groups now. QStringList groups = orderedGroups(); - int location(groups.indexOf(QStringLiteral("Macros"))); + int location(groups.indexOf(QLatin1String("Macros"))); if (location == -1) location = groups.size(); //add row diff --git a/src/Gui/DlgMacroExecuteImp.cpp b/src/Gui/DlgMacroExecuteImp.cpp index a3a7cbd9ea96..b6c1609fa6d2 100644 --- a/src/Gui/DlgMacroExecuteImp.cpp +++ b/src/Gui/DlgMacroExecuteImp.cpp @@ -224,7 +224,7 @@ void DlgMacroExecuteImp::fillUpList() item->setText(0, fn); } - QString dirstr = QString::fromStdString(App::Application::getHomePath()) + QStringLiteral("Macro"); + QString dirstr = QString::fromStdString(App::Application::getHomePath()) + QLatin1String("Macro"); filteredByContent = this->filterFiles(dirstr); ui->systemMacroListBox->clear(); @@ -380,7 +380,7 @@ void DlgMacroExecuteImp::accept() dir =QDir(this->macroPath); } else { - QString dirstr = QString::fromStdString(App::Application::getHomePath()) + QStringLiteral("Macro"); + QString dirstr = QString::fromStdString(App::Application::getHomePath()) + QLatin1String("Macro"); dir = QDir(dirstr); } @@ -436,7 +436,7 @@ void DlgMacroExecuteImp::onEditButtonClicked() else { //index == 1 system-wide item = ui->systemMacroListBox->currentItem(); - dir.setPath(QString::fromStdString(App::Application::getHomePath()) + QStringLiteral("Macro")); + dir.setPath(QString::fromStdString(App::Application::getHomePath()) + QLatin1String("Macro")); } if (!item) @@ -613,37 +613,37 @@ Note: your changes will be applied when you next switch workbenches\n")); /** title is normally "Customize" **/ dlg.setWindowTitle(tr("Walkthrough, dialog 1 of 2")); - tabWidget = dlg.findChild(QStringLiteral("Gui__Dialog__TabWidget")); + tabWidget = dlg.findChild(QLatin1String("Gui__Dialog__TabWidget")); if (!tabWidget) { std::cerr << "Toolbar walkthrough error: Unable to find tabwidget" << std::endl; return; } - auto setupCustomMacrosPage = tabWidget->findChild(QStringLiteral("Gui__Dialog__DlgCustomActions")); + auto setupCustomMacrosPage = tabWidget->findChild(QLatin1String("Gui__Dialog__DlgCustomActions")); if (!setupCustomMacrosPage) { std::cerr << "Toolbar walkthrough error: Unable to find setupCustomMacrosPage" << std::endl; return; } tabWidget->setCurrentWidget(setupCustomMacrosPage); - auto groupBox7 = setupCustomMacrosPage->findChild(QStringLiteral("GroupBox7")); + auto groupBox7 = setupCustomMacrosPage->findChild(QLatin1String("GroupBox7")); if (!groupBox7) { Base::Console().Warning("Toolbar walkthrough: Unable to find groupBox7\n"); //just warn when not a fatal error } else { /** normally the groupbox title is "Setup Custom Macros", but we change it here **/ groupBox7->setTitle(tr("Walkthrough instructions: Fill in missing fields (optional) then click Add, then Close")); - groupBox7->setStyleSheet(QStringLiteral("QGroupBox::title {color:red}")); + groupBox7->setStyleSheet(QLatin1String("QGroupBox::title {color:red}")); } - auto buttonAddAction = setupCustomMacrosPage->findChild(QStringLiteral("buttonAddAction")); + auto buttonAddAction = setupCustomMacrosPage->findChild(QLatin1String("buttonAddAction")); if (!buttonAddAction) { Base::Console().Warning("Toolbar walkthrough: Unable to find buttonAddAction\n"); } else { - buttonAddAction->setStyleSheet(QStringLiteral("color:red")); + buttonAddAction->setStyleSheet(QLatin1String("color:red")); } - auto macroListBox = setupCustomMacrosPage->findChild(QStringLiteral("actionMacros")); + auto macroListBox = setupCustomMacrosPage->findChild(QLatin1String("actionMacros")); if (!macroListBox) { Base::Console().Warning("Toolbar walkthrough: Unable to find actionMacros combo box\n"); } else { @@ -651,7 +651,7 @@ Note: your changes will be applied when you next switch workbenches\n")); macroListBox->setCurrentIndex(macroIndex); //select it for the user so they don't have to } - auto menuText = setupCustomMacrosPage->findChild(QStringLiteral("actionMenu")); + auto menuText = setupCustomMacrosPage->findChild(QLatin1String("actionMenu")); if (!menuText) { Base::Console().Warning("Toolbar walkthrough: Unable to find actionMenu menuText\n"); } else { @@ -672,38 +672,38 @@ Note: your changes will be applied when you next switch workbenches\n")); } tabWidget = nullptr; - tabWidget = dlg.findChild(QStringLiteral("Gui__Dialog__TabWidget")); + tabWidget = dlg.findChild(QLatin1String("Gui__Dialog__TabWidget")); if (!tabWidget) { std::cerr << "Toolbar walkthrough: Unable to find tabWidget Gui__Dialog__TabWidget" << std::endl; return; } - auto setupToolbarPage = tabWidget->findChild(QStringLiteral("Gui__Dialog__DlgCustomToolbars")); + auto setupToolbarPage = tabWidget->findChild(QLatin1String("Gui__Dialog__DlgCustomToolbars")); if (!setupToolbarPage){ std::cerr << "Toolbar walkthrough: Unable to find setupToolbarPage Gui__Dialog__DlgCustomToolbars" << std::endl; return; } tabWidget->setCurrentWidget(setupToolbarPage); - auto moveActionRightButton = setupToolbarPage->findChild(QStringLiteral("moveActionRightButton")); + auto moveActionRightButton = setupToolbarPage->findChild(QLatin1String("moveActionRightButton")); if (!moveActionRightButton){ Base::Console().Warning("Toolbar walkthrough: Unable to find moveActionRightButton\n"); } else { - moveActionRightButton->setStyleSheet(QStringLiteral("background-color: red")); + moveActionRightButton->setStyleSheet(QLatin1String("background-color: red")); } /** tailor instructions depending on whether user already has custom toolbar created * if not, they need to click New button to create one first **/ QString instructions2 = tr("Walkthrough instructions: Click right arrow button (->), then Close."); - auto workbenchBox = setupToolbarPage->findChild(QStringLiteral("workbenchBox")); + auto workbenchBox = setupToolbarPage->findChild(QLatin1String("workbenchBox")); if (!workbenchBox) { Base::Console().Warning("Toolbar walkthrough: Unable to find workbenchBox\n"); } else { /** find the Global workbench and select it for the user **/ - int globalIdx = workbenchBox->findData(QStringLiteral("Global")); + int globalIdx = workbenchBox->findData(QLatin1String("Global")); if (globalIdx != -1){ workbenchBox->setCurrentIndex(globalIdx); QMetaObject::invokeMethod(setupToolbarPage, "on_workbenchBox_activated", @@ -714,27 +714,27 @@ Note: your changes will be applied when you next switch workbenches\n")); } if (!hasCustomToolbar){ - auto newButton = setupToolbarPage->findChild(QStringLiteral("newButton")); + auto newButton = setupToolbarPage->findChild(QLatin1String("newButton")); if (!newButton){ Base::Console().Warning("Toolbar walkthrough: Unable to find newButton\n"); } else { - newButton->setStyleSheet(QStringLiteral("color:red")); + newButton->setStyleSheet(QLatin1String("color:red")); instructions2 = tr("Walkthrough instructions: Click New, then right arrow (->) button, then Close."); } } } /** "label" normally says "Note: the changes become active the next time you load the appropriate workbench" **/ - auto label = setupToolbarPage->findChild(QStringLiteral("label")); + auto label = setupToolbarPage->findChild(QLatin1String("label")); if (!label){ Base::Console().Warning("Toolbar walkthrough: Unable to find label\n"); } else { label->setText(instructions2); - label->setStyleSheet(QStringLiteral("color:red")); + label->setStyleSheet(QLatin1String("color:red")); } /** find Macros category and select it for the user **/ - auto categoryBox = setupToolbarPage->findChild(QStringLiteral("categoryBox")); + auto categoryBox = setupToolbarPage->findChild(QLatin1String("categoryBox")); if (!categoryBox){ Base::Console().Warning("Toolbar walkthrough: Unable to find categoryBox\n"); } else { @@ -750,7 +750,7 @@ Note: your changes will be applied when you next switch workbenches\n")); } /** expand custom toolbar items **/ - auto toolbarTreeWidget = setupToolbarPage->findChild(QStringLiteral("toolbarTreeWidget")); + auto toolbarTreeWidget = setupToolbarPage->findChild(QLatin1String("toolbarTreeWidget")); if (!toolbarTreeWidget) { Base::Console().Warning("Toolbar walkthrough: Unable to find toolbarTreeWidget\n"); } else { @@ -759,7 +759,7 @@ Note: your changes will be applied when you next switch workbenches\n")); /** preselect macro command for user **/ - auto commandTreeWidget = setupToolbarPage->findChild(QStringLiteral("commandTreeWidget")); + auto commandTreeWidget = setupToolbarPage->findChild(QLatin1String("commandTreeWidget")); if (!commandTreeWidget) { Base::Console().Warning("Toolbar walkthrough: Unable to find commandTreeWidget\n"); } else { diff --git a/src/Gui/DlgParameterImp.cpp b/src/Gui/DlgParameterImp.cpp index 9e5fc139f14a..ba73beefa421 100644 --- a/src/Gui/DlgParameterImp.cpp +++ b/src/Gui/DlgParameterImp.cpp @@ -213,7 +213,7 @@ void DlgParameterImp::onFindGroupTtextChanged(const QString &SearchStr) } else { // Set red background to indicate no matching - QString styleSheet = QStringLiteral( + QString styleSheet = QLatin1String( " QLineEdit {\n" " background-color: rgb(221,144,161);\n" " }\n" @@ -912,8 +912,8 @@ void ParameterValue::onCreateBoolItem() } } - QStringList list; list << QStringLiteral("true") - << QStringLiteral("false"); + QStringList list; list << QLatin1String("true") + << QLatin1String("false"); QString val = QInputDialog::getItem (this, QObject::tr("New boolean item"), QObject::tr("Choose an item:"), list, 0, false, &ok, Qt::MSWindowsFixedSizeDialogHint); if ( ok ) @@ -1042,7 +1042,7 @@ ParameterText::ParameterText ( QTreeWidget * parent, QString label, const char* { setIcon(0, BitmapFactory().iconFromTheme("Param_Text") ); setText(0, label); - setText(1, QStringLiteral("Text")); + setText(1, QLatin1String("Text")); setText(2, QString::fromUtf8(value)); } @@ -1084,7 +1084,7 @@ ParameterInt::ParameterInt ( QTreeWidget * parent, QString label, long value, co { setIcon(0, BitmapFactory().iconFromTheme("Param_Int") ); setText(0, label); - setText(1, QStringLiteral("Integer")); + setText(1, QLatin1String("Integer")); setText(2, QString::fromUtf8("%1").arg(value)); } @@ -1097,7 +1097,7 @@ void ParameterInt::changeValue() text(2).toInt(), -2147483647, 2147483647, 1, &ok, Qt::MSWindowsFixedSizeDialogHint); if ( ok ) { - setText(2, QStringLiteral("%1").arg(num)); + setText(2, QLatin1String("%1").arg(num)); _hcGrp->SetInt(text(0).toUtf8(), (long)num); } } @@ -1126,7 +1126,7 @@ ParameterUInt::ParameterUInt ( QTreeWidget * parent, QString label, unsigned lon { setIcon(0, BitmapFactory().iconFromTheme("Param_UInt") ); setText(0, label); - setText(1, QStringLiteral("Unsigned")); + setText(1, QLatin1String("Unsigned")); setText(2, QString::fromUtf8("%1").arg(value)); } @@ -1177,7 +1177,7 @@ ParameterFloat::ParameterFloat ( QTreeWidget * parent, QString label, double val { setIcon(0, BitmapFactory().iconFromTheme("Param_Float") ); setText(0, label); - setText(1, QStringLiteral("Float")); + setText(1, QLatin1String("Float")); setText(2, QString::fromUtf8("%1").arg(value)); } @@ -1219,7 +1219,7 @@ ParameterBool::ParameterBool ( QTreeWidget * parent, QString label, bool value, { setIcon(0, BitmapFactory().iconFromTheme("Param_Bool") ); setText(0, label); - setText(1, QStringLiteral("Boolean")); + setText(1, QLatin1String("Boolean")); setText(2, QString::fromUtf8((value ? "true" : "false"))); } @@ -1228,8 +1228,8 @@ ParameterBool::~ParameterBool() = default; void ParameterBool::changeValue() { bool ok; - QStringList list; list << QStringLiteral("true") - << QStringLiteral("false"); + QStringList list; list << QLatin1String("true") + << QLatin1String("false"); int pos = (text(2) == list[0] ? 0 : 1); QString txt = QInputDialog::getItem (treeWidget(), QObject::tr("Change value"), QObject::tr("Choose an item:"), diff --git a/src/Gui/DlgPropertyLink.cpp b/src/Gui/DlgPropertyLink.cpp index fc7c83a70505..77ba619685fd 100644 --- a/src/Gui/DlgPropertyLink.cpp +++ b/src/Gui/DlgPropertyLink.cpp @@ -144,7 +144,7 @@ QList DlgPropertyLink::getLinksFromProperty(const App::Property QString DlgPropertyLink::formatObject(App::Document *ownerDoc, App::DocumentObject *obj, const char *sub) { if(!obj || !obj->isAttachedToDocument()) - return QStringLiteral("?"); + return QLatin1String("?"); const char *objName = obj->getNameInDocument(); std::string _objName; @@ -191,7 +191,7 @@ QString DlgPropertyLink::formatLinks(App::Document *ownerDoc, QList3?QStringLiteral(" ..."):QStringLiteral("")); + list.join(QLatin1String(", ")), + links.size()>3?QLatin1String(" ..."):QLatin1String("")); } int i = 0; @@ -215,8 +215,8 @@ QString DlgPropertyLink::formatLinks(App::Document *ownerDoc, QList= 3) break; } - return QStringLiteral("[%1%2]").arg(list.join(QStringLiteral(", ")), - links.size() > 3 ? QStringLiteral(" ...") : QStringLiteral("")); + return QStringLiteral("[%1%2]").arg(list.join(QLatin1String(", ")), + links.size() > 3 ? QLatin1String(" ...") : QLatin1String("")); } void DlgPropertyLink::init(const App::DocumentObjectT &prop, bool tryFilter) { @@ -672,7 +672,7 @@ void DlgPropertyLink::onSelectionChanged(const Gui::SelectionChanges& msg) list = text.split(QLatin1Char(',')); if(list.indexOf(element)<0) { list << element; - item->setText(1, list.join(QStringLiteral(","))); + item->setText(1, list.join(QLatin1String(","))); subSelections.insert(item); } } else if (subSelections.erase(item)) @@ -765,7 +765,7 @@ QList DlgPropertyLink::originalLinks() const QString DlgPropertyLink::linksToPython(const QList& links) { if(links.isEmpty()) - return QStringLiteral("None"); + return QLatin1String("None"); if(links.size() == 1) return QString::fromUtf8(links.front().getSubObjectPython(false).c_str()); diff --git a/src/Gui/DlgSettingsColorGradientImp.cpp b/src/Gui/DlgSettingsColorGradientImp.cpp index b839d01aaf21..48da90933434 100644 --- a/src/Gui/DlgSettingsColorGradientImp.cpp +++ b/src/Gui/DlgSettingsColorGradientImp.cpp @@ -67,7 +67,7 @@ DlgSettingsColorGradientImp::DlgSettingsColorGradientImp(const App::ColorGradien // assure that the LineEdit is as wide to contain numbers with 4 digits and 6 decimals QFontMetrics fm(ui->floatLineEditMax->font()); - ui->floatLineEditMax->setMinimumWidth(QtTools::horizontalAdvance(fm, QStringLiteral("-8000.000000"))); + ui->floatLineEditMax->setMinimumWidth(QtTools::horizontalAdvance(fm, QLatin1String("-8000.000000"))); setColorModelNames(cg.getColorModelNames()); setProfile(cg.getProfile()); diff --git a/src/Gui/DlgToolbarsImp.cpp b/src/Gui/DlgToolbarsImp.cpp index 26c561b69889..38381eb1ed56 100644 --- a/src/Gui/DlgToolbarsImp.cpp +++ b/src/Gui/DlgToolbarsImp.cpp @@ -84,11 +84,11 @@ DlgCustomToolbars::DlgCustomToolbars(DlgCustomToolbars::Type t, QWidget* parent) workbenches.sort(); int index = 1; ui->workbenchBox->addItem(QApplication::windowIcon(), tr("Global")); - ui->workbenchBox->setItemData(0, QVariant(QStringLiteral("Global")), Qt::UserRole); + ui->workbenchBox->setItemData(0, QVariant(QLatin1String("Global")), Qt::UserRole); for (const auto & workbench : workbenches) { QPixmap px = Application::Instance->workbenchIcon(workbench); QString mt = Application::Instance->workbenchMenuText(workbench); - if (mt != QStringLiteral("")) { + if (mt != QLatin1String("")) { if (px.isNull()) ui->workbenchBox->addItem(mt); else @@ -513,7 +513,7 @@ void DlgCustomToolbars::onModifyMacroAction(const QByteArray& macro) { QVariant data = ui->categoryBox->itemData(ui->categoryBox->currentIndex(), Qt::UserRole); QString group = data.toString(); - if (group == QStringLiteral("Macros")) + if (group == QLatin1String("Macros")) { CommandManager & cCmdMgr = Application::Instance->commandManager(); Command* pCmd = cCmdMgr.getCommandByName(macro); @@ -653,7 +653,7 @@ void DlgCustomToolbarsImp::setActionGroup(QAction* action, const QList QMenu* menu = tb->menu(); if (!menu) { tb->setPopupMode(QToolButton::MenuButtonPopup); - tb->setObjectName(QStringLiteral("qt_toolbutton_menubutton")); + tb->setObjectName(QLatin1String("qt_toolbutton_menubutton")); auto menu = new QMenu(tb); menu->addActions(group); tb->setMenu(menu); diff --git a/src/Gui/DlgUnitsCalculatorImp.cpp b/src/Gui/DlgUnitsCalculatorImp.cpp index 9a3c05869b5a..6f22ef521df8 100644 --- a/src/Gui/DlgUnitsCalculatorImp.cpp +++ b/src/Gui/DlgUnitsCalculatorImp.cpp @@ -50,7 +50,7 @@ DlgUnitsCalculator::DlgUnitsCalculator( QWidget* parent, Qt::WindowFlags fl ) ui->setupUi(this); this->setAttribute(Qt::WA_DeleteOnClose); - ui->comboBoxScheme->addItem(QStringLiteral("Preference system"), static_cast(-1)); + ui->comboBoxScheme->addItem(QLatin1String("Preference system"), static_cast(-1)); int num = static_cast(Base::UnitSystem::NumUnitSystemTypes); for (int i=0; i(i)); @@ -75,8 +75,8 @@ DlgUnitsCalculator::DlgUnitsCalculator( QWidget* parent, Qt::WindowFlags fl ) ui->ValueInput->setParamGrpPath(QByteArray("User parameter:BaseApp/History/UnitsCalculator")); // set a default that also illustrates how the dialog works - ui->ValueInput->setText(QStringLiteral("1 cm")); - ui->UnitInput->setText(QStringLiteral("in")); + ui->ValueInput->setText(QLatin1String("1 cm")); + ui->UnitInput->setText(QLatin1String("in")); units << Base::Unit::Acceleration << Base::Unit::AmountOfSubstance @@ -157,7 +157,7 @@ void DlgUnitsCalculator::valueChanged(const Base::Quantity& quant) // first check the unit, if it is invalid, getTypeString() outputs an empty string // explicitly check for "ee" like in "eeV" because this would trigger an exception in Base::Unit // since it expects then a scientific notation number like "1e3" - if ( (ui->UnitInput->text().mid(0, 2) == QStringLiteral("ee")) || + if ( (ui->UnitInput->text().mid(0, 2) == QLatin1String("ee")) || Base::Unit(ui->UnitInput->text()).getTypeString().isEmpty()) { ui->ValueOutput->setText(QString::fromUtf8("%1 %2").arg(tr("unknown unit:"), ui->UnitInput->text())); ui->pushButton_Copy->setEnabled(false); @@ -167,7 +167,7 @@ void DlgUnitsCalculator::valueChanged(const Base::Quantity& quant) ui->ValueOutput->setText(tr("unit mismatch")); ui->pushButton_Copy->setEnabled(false); } else { // the unit is valid and has the same type - double convertValue = Base::Quantity::parse(QStringLiteral("1") + ui->UnitInput->text()).getValue(); + double convertValue = Base::Quantity::parse(QLatin1String("1") + ui->UnitInput->text()).getValue(); // we got now e.g. for "1 in" the value '25.4' because 1 in = 25.4 mm // the result is now just quant / convertValue because the input is always in a base unit // (an input of "1 cm" will immediately be converted to "10 mm" by Gui::InputField of the dialog) @@ -204,7 +204,7 @@ void DlgUnitsCalculator::copy() void DlgUnitsCalculator::returnPressed() { if (ui->pushButton_Copy->isEnabled()) { - ui->textEdit->append(ui->ValueInput->text() + QStringLiteral(" = ") + ui->ValueOutput->text()); + ui->textEdit->append(ui->ValueInput->text() + QLatin1String(" = ") + ui->ValueOutput->text()); ui->ValueInput->pushToHistory(); } } diff --git a/src/Gui/DocumentRecovery.cpp b/src/Gui/DocumentRecovery.cpp index 5cd2d79eb80f..e9e2701dd95d 100644 --- a/src/Gui/DocumentRecovery.cpp +++ b/src/Gui/DocumentRecovery.cpp @@ -212,7 +212,7 @@ QString DocumentRecovery::createProjectFile(const QString& documentXml) { QString source = documentXml; QFileInfo fi(source); - QString dest = fi.dir().absoluteFilePath(QStringLiteral("fc_recovery_file.fcstd")); + QString dest = fi.dir().absoluteFilePath(QLatin1String("fc_recovery_file.fcstd")); std::stringstream str; str << doctools << "\n"; @@ -412,16 +412,16 @@ DocumentRecoveryPrivate::Info DocumentRecoveryPrivate::getRecoveryInfo(const QFi if (doc_dir.exists(QLatin1String("fc_recovery_file.xml"))) { XmlConfig cfg = readXmlFile(info.xmlFile); - if (cfg.contains(QStringLiteral("Label"))) { - info.label = cfg[QStringLiteral("Label")]; + if (cfg.contains(QLatin1String("Label"))) { + info.label = cfg[QLatin1String("Label")]; } - if (cfg.contains(QStringLiteral("FileName"))) { - info.fileName = cfg[QStringLiteral("FileName")]; + if (cfg.contains(QLatin1String("FileName"))) { + info.fileName = cfg[QLatin1String("FileName")]; } - if (cfg.contains(QStringLiteral("Status"))) { - QString status = cfg[QStringLiteral("Status")]; + if (cfg.contains(QLatin1String("Status"))) { + QString status = cfg[QLatin1String("Status")]; if (status == QLatin1String("Deprecated")) info.status = DocumentRecoveryPrivate::Overage; else if (status == QLatin1String("Success")) @@ -467,16 +467,16 @@ DocumentRecoveryPrivate::XmlConfig DocumentRecoveryPrivate::readXmlFile(const QS } QDomElement root = domDocument.documentElement(); - if (root.tagName() != QStringLiteral("AutoRecovery")) { + if (root.tagName() != QLatin1String("AutoRecovery")) { return cfg; } file.close(); QVector filter; - filter << QStringLiteral("Label"); - filter << QStringLiteral("FileName"); - filter << QStringLiteral("Status"); + filter << QLatin1String("Label"); + filter << QLatin1String("FileName"); + filter << QLatin1String("Status"); QDomElement child; if (!root.isNull()) { @@ -590,7 +590,7 @@ void DocumentRecoveryFinder::checkDocumentDirs(QDir& tmp, const QList } else { int countDeletedDocs = 0; - QString recovery_files = QStringLiteral("fc_recovery_files"); + QString recovery_files = QLatin1String("fc_recovery_files"); for (QList::const_iterator it = dirs.cbegin(); it != dirs.cend(); ++it) { QDir doc_dir(it->absoluteFilePath()); doc_dir.setFilter(QDir::NoDotAndDotDot|QDir::AllEntries); @@ -646,7 +646,7 @@ bool DocumentRecoveryFinder::showRecoveryDialogIfNeeded() void DocumentRecoveryHandler::checkForPreviousCrashes(const std::function&, const QString&)> & callableFunc) const { QDir tmp = QString::fromUtf8(App::Application::getUserCachePath().c_str()); - tmp.setNameFilters(QStringList() << QStringLiteral("*.lock")); + tmp.setNameFilters(QStringList() << QLatin1String("*.lock")); tmp.setFilter(QDir::Files); QString exeName = QString::fromStdString(App::Application::getExecutableName()); diff --git a/src/Gui/EditorView.cpp b/src/Gui/EditorView.cpp index d532e3ee1a65..06c209ef2395 100644 --- a/src/Gui/EditorView.cpp +++ b/src/Gui/EditorView.cpp @@ -834,7 +834,7 @@ void SearchBar::findText(bool skip, bool next, const QString& str) QString styleSheet; if (!found) { - styleSheet = QStringLiteral( + styleSheet = QLatin1String( " QLineEdit {\n" " background-color: rgb(221,144,161);\n" " }\n" diff --git a/src/Gui/FileDialog.cpp b/src/Gui/FileDialog.cpp index a4d13c465c32..7a443908ccec 100644 --- a/src/Gui/FileDialog.cpp +++ b/src/Gui/FileDialog.cpp @@ -144,7 +144,7 @@ void FileDialog::accept() if (!ext.isEmpty() && (suffix.isEmpty() || !hasSuffix(suffix))) { file = QString::fromUtf8("%1.%2").arg(file, ext); // That's the built-in line edit - auto fileNameEdit = this->findChild(QStringLiteral("fileNameEdit")); + auto fileNameEdit = this->findChild(QLatin1String("fileNameEdit")); if (fileNameEdit) fileNameEdit->setText(file); } @@ -506,7 +506,7 @@ void FileOptionsDialog::accept() fn = QString::fromUtf8("%1.%2").arg(fn, suf); selectFile(fn); // That's the built-in line edit (fixes Debian bug #811200) - auto fileNameEdit = this->findChild(QStringLiteral("fileNameEdit")); + auto fileNameEdit = this->findChild(QLatin1String("fileNameEdit")); if (fileNameEdit) fileNameEdit->setText(fn); } @@ -616,7 +616,7 @@ QIcon FileIconProvider::icon(const QFileInfo & info) const return icon; } - return QIcon(QStringLiteral(":/icons/freecad-doc.png")); + return QIcon(QLatin1String(":/icons/freecad-doc.png")); }; if (info.suffix().toLower() == QLatin1String("fcstd")) { @@ -626,7 +626,7 @@ QIcon FileIconProvider::icon(const QFileInfo & info) const return iconFromFile(thumb); } else if (info.suffix().toLower().startsWith(QLatin1String("fcstd"))) { - QIcon icon(QStringLiteral(":/icons/freecad-doc.png")); + QIcon icon(QLatin1String(":/icons/freecad-doc.png")); QIcon darkIcon; int w = QApplication::style()->pixelMetric(QStyle::PM_ListViewIconSize); darkIcon.addPixmap(icon.pixmap(w, w, QIcon::Disabled, QIcon::Off), QIcon::Normal, QIcon::Off); diff --git a/src/Gui/InputField.cpp b/src/Gui/InputField.cpp index 06e7fb4d7373..a474cbca10b7 100644 --- a/src/Gui/InputField.cpp +++ b/src/Gui/InputField.cpp @@ -718,13 +718,13 @@ void InputField::fixup(QString& input) const { input.remove(locale().groupSeparator()); - QString asciiMinus(QStringLiteral("-")); + QString asciiMinus(QLatin1String("-")); QString localeMinus(locale().negativeSign()); if (localeMinus != asciiMinus) { input.replace(localeMinus, asciiMinus); } - QString asciiPlus(QStringLiteral("+")); + QString asciiPlus(QLatin1String("+")); QString localePlus(locale().positiveSign()); if (localePlus != asciiPlus) { input.replace(localePlus, asciiPlus); diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 4081fffb1e44..e57865e7284f 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -1767,13 +1767,13 @@ void MainWindow::loadWindowSettings() int maxWidth = rect.width(); config.beginGroup(qtver); - QPoint pos = config.value(QStringLiteral("Position"), this->pos()).toPoint(); + QPoint pos = config.value(QLatin1String("Position"), this->pos()).toPoint(); maxWidth -= pos.x(); maxHeight -= pos.y(); - QSize size = config.value(QStringLiteral("Size"), QSize(maxWidth, maxHeight)).toSize(); - bool max = config.value(QStringLiteral("Maximized"), false).toBool(); - bool showStatusBar = config.value(QStringLiteral("StatusBar"), true).toBool(); - QByteArray windowState = config.value(QStringLiteral("MainWindowState")).toByteArray(); + QSize size = config.value(QLatin1String("Size"), QSize(maxWidth, maxHeight)).toSize(); + bool max = config.value(QLatin1String("Maximized"), false).toBool(); + bool showStatusBar = config.value(QLatin1String("StatusBar"), true).toBool(); + QByteArray windowState = config.value(QLatin1String("MainWindowState")).toByteArray(); config.endGroup(); @@ -1866,11 +1866,11 @@ void MainWindow::saveWindowSettings(bool canDelay) #if 0 config.beginGroup(qtver); - config.setValue(QStringLiteral("Size"), this->size()); - config.setValue(QStringLiteral("Position"), this->pos()); - config.setValue(QStringLiteral("Maximized"), this->isMaximized()); - config.setValue(QStringLiteral("MainWindowState"), this->saveState()); - config.setValue(QStringLiteral("StatusBar"), this->statusBar()->isVisible()); + config.setValue(QLatin1String("Size"), this->size()); + config.setValue(QLatin1String("Position"), this->pos()); + config.setValue(QLatin1String("Maximized"), this->isMaximized()); + config.setValue(QLatin1String("MainWindowState"), this->saveState()); + config.setValue(QLatin1String("StatusBar"), this->statusBar()->isVisible()); config.endGroup(); #else // We are migrating from saving qt main window layout state in QSettings to diff --git a/src/Gui/NaviCube.cpp b/src/Gui/NaviCube.cpp index 9e3a62d66c81..7dfccf13c3d0 100644 --- a/src/Gui/NaviCube.cpp +++ b/src/Gui/NaviCube.cpp @@ -417,7 +417,7 @@ int imageVerticalBalance(QImage p, int sizeHint) { void NaviCubeImplementation::createCubeFaceTextures() { int texSize = 192; // Works well for the max cube size 1024 QFont font; - if (m_TextFont.empty()) font.fromString(QStringLiteral("Arial")); + if (m_TextFont.empty()) font.fromString(QLatin1String("Arial")); else font.fromString(QString::fromStdString(m_TextFont)); font.setStyleHint(QFont::SansSerif); if (m_FontWeight > 0) { diff --git a/src/Gui/NotificationArea.cpp b/src/Gui/NotificationArea.cpp index 1f4ad2e8c5c5..483e8d4373c8 100644 --- a/src/Gui/NotificationArea.cpp +++ b/src/Gui/NotificationArea.cpp @@ -159,9 +159,9 @@ class ResourceManager critical = BitmapFactory().pixmapFromSvg(":/icons/critical-info.svg", QSize(16, 16)); info = BitmapFactory().pixmapFromSvg(":/icons/info.svg", QSize(16, 16)); //NOLINTEND - notificationArea = QIcon(QStringLiteral(":/icons/InTray.svg")); + notificationArea = QIcon(QLatin1String(":/icons/InTray.svg")); notificationAreaMissedNotifications = - QIcon(QStringLiteral(":/icons/InTray_missed_notifications.svg")); + QIcon(QLatin1String(":/icons/InTray_missed_notifications.svg")); } inline static const auto& getResourceManager() @@ -1084,8 +1084,8 @@ bool NotificationArea::confirmationRequired(Base::LogStyle level) void NotificationArea::showConfirmationDialog(const QString& notifiername, const QString& message) { - auto confirmMsg = QObject::tr("Notifier:") + QStringLiteral(" ") + notifiername + QStringLiteral("\n\n") + message - + QStringLiteral("\n\n") + auto confirmMsg = QObject::tr("Notifier:") + QLatin1String(" ") + notifiername + QLatin1String("\n\n") + message + + QLatin1String("\n\n") + QObject::tr("Do you want to skip confirmation of further critical message notifications " "while loading the file?"); @@ -1171,16 +1171,16 @@ void NotificationArea::showInNotificationArea() QString iconstr; if (item->isType(Base::LogStyle::Error)) { - iconstr = QStringLiteral(":/icons/edit_Cancel.svg"); + iconstr = QLatin1String(":/icons/edit_Cancel.svg"); } else if (item->isType(Base::LogStyle::Warning)) { - iconstr = QStringLiteral(":/icons/Warning.svg"); + iconstr = QLatin1String(":/icons/Warning.svg"); } else if (item->isType(Base::LogStyle::Critical)) { - iconstr = QStringLiteral(":/icons/critical-info.svg"); + iconstr = QLatin1String(":/icons/critical-info.svg"); } else { - iconstr = QStringLiteral(":/icons/info.svg"); + iconstr = QLatin1String(":/icons/info.svg"); } QString tmpmessage = diff --git a/src/Gui/OverlayManager.cpp b/src/Gui/OverlayManager.cpp index d5294315c0c6..dd1f72c0bd89 100644 --- a/src/Gui/OverlayManager.cpp +++ b/src/Gui/OverlayManager.cpp @@ -145,13 +145,13 @@ class OverlayStyleSheet: public ParameterGrp::ObserverType { if (overlayStyleSheet.isEmpty()) { // User did not choose any stylesheet, we need to choose one based on main stylesheet - if (mainStyleSheet.contains(QStringLiteral("light"), Qt::CaseInsensitive)) { - overlayStyleSheet = QStringLiteral("overlay:Light-Outline.qss"); + if (mainStyleSheet.contains(QLatin1String("light"), Qt::CaseInsensitive)) { + overlayStyleSheet = QLatin1String("overlay:Light-Outline.qss"); } else { // by default FreeCAD uses somewhat dark background for 3D View. // if user has not explicitly selected light theme, the "Dark Outline" looks best - overlayStyleSheet = QStringLiteral("overlay:Dark-Outline.qss"); + overlayStyleSheet = QLatin1String("overlay:Dark-Outline.qss"); } } else if (!overlayStyleSheet.isEmpty() && !QFile::exists(overlayStyleSheet)) { @@ -177,7 +177,7 @@ class OverlayStyleSheet: public ParameterGrp::ObserverType { static const QString _default; }; -const QString OverlayStyleSheet::_default = QStringLiteral( +const QString OverlayStyleSheet::_default = QLatin1String( "* {alternate-background-color: rgba(250,250,250,120)}" "QComboBox, QComboBox:editable, QComboBox:!editable, QLineEdit," @@ -261,7 +261,7 @@ struct OverlayInfo { { tabWidget = new OverlayTabWidget(parent, dockArea); tabWidget->setObjectName(QString::fromUtf8(name)); - tabWidget->getProxyWidget()->setObjectName(tabWidget->objectName() + QStringLiteral("Proxy")); + tabWidget->getProxyWidget()->setObjectName(tabWidget->objectName() + QLatin1String("Proxy")); tabWidget->setMovable(true); hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp") ->GetGroup("MainWindow")->GetGroup("DockWindows")->GetGroup(name); @@ -442,9 +442,9 @@ class OverlayManager::Private { refresh(); }); - _actOverlay.setData(QStringLiteral("OBTN Overlay")); - _actFloat.setData(QStringLiteral("OBTN Float")); - _actClose.setData(QStringLiteral("OBTN Close")); + _actOverlay.setData(QLatin1String("OBTN Overlay")); + _actFloat.setData(QLatin1String("OBTN Float")); + _actClose.setData(QLatin1String("OBTN Close")); retranslate(); refreshIcons(); @@ -988,7 +988,7 @@ class OverlayManager::Private { QWidget *createTitleBar(QWidget *parent) { OverlayTitleBar *widget = new OverlayTitleBar(parent); - widget->setObjectName(QStringLiteral("OverlayTitle")); + widget->setObjectName(QLatin1String("OverlayTitle")); QList actions; if (auto tabWidget = qobject_cast(parent)) diff --git a/src/Gui/OverlayParams.cpp b/src/Gui/OverlayParams.cpp index 5d0bbe08dbc4..c8fd34a5200a 100644 --- a/src/Gui/OverlayParams.cpp +++ b/src/Gui/OverlayParams.cpp @@ -1046,47 +1046,47 @@ void OverlayParams::removeDockOverlayMinimumSize() { // Auto generated code (Gui/OverlayParams.py:171) const std::vector OverlayParams::AnimationCurveTypes = { - QStringLiteral("Linear"), - QStringLiteral("InQuad"), - QStringLiteral("OutQuad"), - QStringLiteral("InOutQuad"), - QStringLiteral("OutInQuad"), - QStringLiteral("InCubic"), - QStringLiteral("OutCubic"), - QStringLiteral("InOutCubic"), - QStringLiteral("OutInCubic"), - QStringLiteral("InQuart"), - QStringLiteral("OutQuart"), - QStringLiteral("InOutQuart"), - QStringLiteral("OutInQuart"), - QStringLiteral("InQuint"), - QStringLiteral("OutQuint"), - QStringLiteral("InOutQuint"), - QStringLiteral("OutInQuint"), - QStringLiteral("InSine"), - QStringLiteral("OutSine"), - QStringLiteral("InOutSine"), - QStringLiteral("OutInSine"), - QStringLiteral("InExpo"), - QStringLiteral("OutExpo"), - QStringLiteral("InOutExpo"), - QStringLiteral("OutInExpo"), - QStringLiteral("InCirc"), - QStringLiteral("OutCirc"), - QStringLiteral("InOutCirc"), - QStringLiteral("OutInCirc"), - QStringLiteral("InElastic"), - QStringLiteral("OutElastic"), - QStringLiteral("InOutElastic"), - QStringLiteral("OutInElastic"), - QStringLiteral("InBack"), - QStringLiteral("OutBack"), - QStringLiteral("InOutBack"), - QStringLiteral("OutInBack"), - QStringLiteral("InBounce"), - QStringLiteral("OutBounce"), - QStringLiteral("InOutBounce"), - QStringLiteral("OutInBounce"), + QLatin1String("Linear"), + QLatin1String("InQuad"), + QLatin1String("OutQuad"), + QLatin1String("InOutQuad"), + QLatin1String("OutInQuad"), + QLatin1String("InCubic"), + QLatin1String("OutCubic"), + QLatin1String("InOutCubic"), + QLatin1String("OutInCubic"), + QLatin1String("InQuart"), + QLatin1String("OutQuart"), + QLatin1String("InOutQuart"), + QLatin1String("OutInQuart"), + QLatin1String("InQuint"), + QLatin1String("OutQuint"), + QLatin1String("InOutQuint"), + QLatin1String("OutInQuint"), + QLatin1String("InSine"), + QLatin1String("OutSine"), + QLatin1String("InOutSine"), + QLatin1String("OutInSine"), + QLatin1String("InExpo"), + QLatin1String("OutExpo"), + QLatin1String("InOutExpo"), + QLatin1String("OutInExpo"), + QLatin1String("InCirc"), + QLatin1String("OutCirc"), + QLatin1String("InOutCirc"), + QLatin1String("OutInCirc"), + QLatin1String("InElastic"), + QLatin1String("OutElastic"), + QLatin1String("InOutElastic"), + QLatin1String("OutInElastic"), + QLatin1String("InBack"), + QLatin1String("OutBack"), + QLatin1String("InOutBack"), + QLatin1String("OutInBack"), + QLatin1String("InBounce"), + QLatin1String("OutBounce"), + QLatin1String("InOutBounce"), + QLatin1String("OutInBounce"), }; //[[[end]]] diff --git a/src/Gui/OverlayWidgets.cpp b/src/Gui/OverlayWidgets.cpp index 600a17976dd1..8bdc3f081652 100644 --- a/src/Gui/OverlayWidgets.cpp +++ b/src/Gui/OverlayWidgets.cpp @@ -386,21 +386,21 @@ OverlayTabWidget::OverlayTabWidget(QWidget *parent, Qt::DockWidgetArea pos) hide(); actTransparent.setCheckable(true); - actTransparent.setData(QStringLiteral("OBTN Transparent")); + actTransparent.setData(QLatin1String("OBTN Transparent")); actTransparent.setParent(this); addAction(&actTransparent); - actAutoHide.setData(QStringLiteral("OBTN AutoHide")); + actAutoHide.setData(QLatin1String("OBTN AutoHide")); - actEditHide.setData(QStringLiteral("OBTN EditHide")); + actEditHide.setData(QLatin1String("OBTN EditHide")); - actEditShow.setData(QStringLiteral("OBTN EditShow")); + actEditShow.setData(QLatin1String("OBTN EditShow")); - actTaskShow.setData(QStringLiteral("OBTN TaskShow")); + actTaskShow.setData(QLatin1String("OBTN TaskShow")); - actNoAutoMode.setData(QStringLiteral("OBTN NoAutoMode")); + actNoAutoMode.setData(QLatin1String("OBTN NoAutoMode")); - actAutoMode.setData(QStringLiteral("OBTN AutoMode")); + actAutoMode.setData(QLatin1String("OBTN AutoMode")); actAutoMode.setParent(this); autoModeMenu.hide(); autoModeMenu.setToolTipsVisible(true); @@ -411,7 +411,7 @@ OverlayTabWidget::OverlayTabWidget(QWidget *parent, Qt::DockWidgetArea pos) autoModeMenu.addAction(&actTaskShow); addAction(&actAutoMode); - actOverlay.setData(QStringLiteral("OBTN Overlay")); + actOverlay.setData(QLatin1String("OBTN Overlay")); actOverlay.setParent(this); addAction(&actOverlay); @@ -1057,7 +1057,7 @@ void OverlayTabWidget::_setOverlayMode(QWidget *widget, OverlayOption option) || option == OverlayOption::Disable) widget->setStyleSheet(QString()); else { - static QString _style = QStringLiteral("*{width:0}"); + static QString _style = QLatin1String("*{width:0}"); widget->setStyleSheet(_style); } } @@ -1069,7 +1069,7 @@ void OverlayTabWidget::_setOverlayMode(QWidget *widget, OverlayOption option) if (!TreeParams::getHideScrollBar() || option == OverlayOption::Disable) widget->setStyleSheet(QString()); else { - static QString _style = QStringLiteral("*{width:0}"); + static QString _style = QLatin1String("*{width:0}"); widget->setStyleSheet(_style); } } @@ -1080,7 +1080,7 @@ void OverlayTabWidget::_setOverlayMode(QWidget *widget, OverlayOption option) if (!TreeParams::getHideHeaderView() || option==OverlayOption::Disable) header->setStyleSheet(QString()); else { - static QString _style = QStringLiteral( + static QString _style = QLatin1String( "QHeaderView:section {" "height: 0px;" "background-color: transparent;" @@ -1480,11 +1480,11 @@ void OverlayTabWidget::addWidget(QDockWidget *dock, const QString &title) getMainWindow()->removeDockWidget(dock); auto titleWidget = dock->titleBarWidget(); - if(titleWidget && titleWidget->objectName()==QStringLiteral("OverlayTitle")) { + if(titleWidget && titleWidget->objectName()==QLatin1String("OverlayTitle")) { // replace the title bar with an invisible widget to hide it. The // OverlayTabWidget uses its own title bar for all docks. auto w = new QWidget(); - w->setObjectName(QStringLiteral("OverlayTitle")); + w->setObjectName(QLatin1String("OverlayTitle")); dock->setTitleBarWidget(w); w->hide(); titleWidget->deleteLater(); @@ -1548,7 +1548,7 @@ void OverlayTabWidget::removeWidget(QDockWidget *dock, QDockWidget *lastDock) hide(); w = dock->titleBarWidget(); - if(w && w->objectName() == QStringLiteral("OverlayTitle")) { + if(w && w->objectName() == QLatin1String("OverlayTitle")) { dock->setTitleBarWidget(nullptr); w->deleteLater(); } @@ -2080,7 +2080,7 @@ OverlaySplitter::OverlaySplitter(QWidget *parent) QSplitterHandle * OverlaySplitter::createHandle() { auto widget = new OverlaySplitterHandle(this->orientation(), this); - widget->setObjectName(QStringLiteral("OverlaySplitHandle")); + widget->setObjectName(QLatin1String("OverlaySplitHandle")); QList actions; actions.append(&widget->actFloat); widget->setTitleItem(OverlayTabWidget::prepareTitleWidget(widget, actions)); @@ -2419,7 +2419,7 @@ void OverlayGraphicsEffect::draw(QPainter* painter) if (FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) { static int count; getMainWindow()->showMessage( - QStringLiteral("dock overlay redraw %1").arg(count++)); + QLatin1String("dock overlay redraw %1").arg(count++)); } #endif diff --git a/src/Gui/PreferencePages/DlgSettingsGeneral.cpp b/src/Gui/PreferencePages/DlgSettingsGeneral.cpp index 4e367e6c7133..b97ee12f8dad 100644 --- a/src/Gui/PreferencePages/DlgSettingsGeneral.cpp +++ b/src/Gui/PreferencePages/DlgSettingsGeneral.cpp @@ -562,7 +562,7 @@ void DlgSettingsGeneral::recreatePreferencePackMenu() if (tagString.isEmpty()) tagString.append(QString::fromStdString(tag)); else - tagString.append(QStringLiteral(", ") + QString::fromStdString(tag)); + tagString.append(QLatin1String(", ") + QString::fromStdString(tag)); } auto kind = new QTableWidgetItem(tagString); ui->PreferencePacks->setItem(row, 1, kind); @@ -712,4 +712,4 @@ void DlgSettingsGeneral::attachObserver() handlers.addHandler(ParamKey(hDockWindows->GetGroup("DAGView"), "Enabled"), applyDockWidget); } -#include "moc_DlgSettingsGeneral.cpp" \ No newline at end of file +#include "moc_DlgSettingsGeneral.cpp" diff --git a/src/Gui/PreferencePages/DlgSettingsTheme.cpp b/src/Gui/PreferencePages/DlgSettingsTheme.cpp index bb0a6bb330f4..b4618d54745a 100644 --- a/src/Gui/PreferencePages/DlgSettingsTheme.cpp +++ b/src/Gui/PreferencePages/DlgSettingsTheme.cpp @@ -87,8 +87,8 @@ void DlgSettingsTheme::populateStylesheets(const char *key, QMap cssFiles; QDir dir; if (filter.isEmpty()) { - filter << QStringLiteral("*.qss"); - filter << QStringLiteral("*.css"); + filter << QLatin1String("*.qss"); + filter << QLatin1String("*.css"); } QFileInfoList fileNames; @@ -107,7 +107,7 @@ void DlgSettingsTheme::populateStylesheets(const char *key, combo->clear(); // now add all unique items - combo->addItem(tr(def), QStringLiteral("")); + combo->addItem(tr(def), QLatin1String("")); for (QMap::iterator it = cssFiles.begin(); it != cssFiles.end(); ++it) { combo->addItem(it.key(), it.value()); } diff --git a/src/Gui/PropertyView.cpp b/src/Gui/PropertyView.cpp index 96c66f2b884b..2baf5f65bb0b 100644 --- a/src/Gui/PropertyView.cpp +++ b/src/Gui/PropertyView.cpp @@ -84,13 +84,13 @@ PropertyView::PropertyView(QWidget *parent) pLayout->addWidget(tabs, 0, 0); propertyEditorView = new Gui::PropertyEditor::PropertyEditor(); - propertyEditorView->setObjectName(QStringLiteral("propertyEditorView")); + propertyEditorView->setObjectName(QLatin1String("propertyEditorView")); propertyEditorView->setAutomaticDocumentUpdate(_GetParam()->GetBool("AutoTransactionView", false)); propertyEditorView->setAutomaticExpand(_GetParam()->GetBool("AutoExpandView", false)); tabs->addTab(propertyEditorView, tr("View")); propertyEditorData = new Gui::PropertyEditor::PropertyEditor(); - propertyEditorData->setObjectName(QStringLiteral("propertyEditorData")); + propertyEditorData->setObjectName(QLatin1String("propertyEditorData")); propertyEditorData->setAutomaticDocumentUpdate(_GetParam()->GetBool("AutoTransactionData", true)); propertyEditorData->setAutomaticExpand(_GetParam()->GetBool("AutoExpandData", false)); tabs->addTab(propertyEditorData, tr("Data")); diff --git a/src/Gui/ShortcutManager.cpp b/src/Gui/ShortcutManager.cpp index 16830c514e05..7fac5875b344 100644 --- a/src/Gui/ShortcutManager.cpp +++ b/src/Gui/ShortcutManager.cpp @@ -440,7 +440,7 @@ void ShortcutManager::onTimer() const auto &index = actionMap.get<1>(); static const std::string symbols = "~!@#$%^&*()_+"; - QString shortcut = pendingSequence.toString() + QStringLiteral(", Ctrl+"); + QString shortcut = pendingSequence.toString() + QLatin1String(", Ctrl+"); for (int s : symbols) { QKeySequence k(shortcut + QLatin1Char(s)); auto it = index.lower_bound(ActionKey(k)); diff --git a/src/Gui/Splashscreen.cpp b/src/Gui/Splashscreen.cpp index 15e868b62c14..d2f055d2c7ef 100644 --- a/src/Gui/Splashscreen.cpp +++ b/src/Gui/Splashscreen.cpp @@ -823,8 +823,8 @@ void AboutDialog::copyToClipboard() QString suffix = QString::fromLatin1(config["BuildVersionSuffix"].c_str()); QString build = QString::fromLatin1(config["BuildRevision"].c_str()); - QString deskEnv = QProcessEnvironment::systemEnvironment().value(QStringLiteral("XDG_CURRENT_DESKTOP"), QString()); - QString deskSess = QProcessEnvironment::systemEnvironment().value(QStringLiteral("DESKTOP_SESSION"), QString()); + QString deskEnv = QProcessEnvironment::systemEnvironment().value(QLatin1String("XDG_CURRENT_DESKTOP"), QString()); + QString deskSess = QProcessEnvironment::systemEnvironment().value(QLatin1String("DESKTOP_SESSION"), QString()); QString deskInfo; if ( !(deskEnv.isEmpty() && deskSess.isEmpty()) ) { diff --git a/src/Gui/StartupProcess.cpp b/src/Gui/StartupProcess.cpp index 021a1cda496c..5eb0f578a259 100644 --- a/src/Gui/StartupProcess.cpp +++ b/src/Gui/StartupProcess.cpp @@ -141,7 +141,7 @@ void StartupProcess::setStyleSheetPaths() + "Gui/Stylesheets/overlay").c_str()) << QString::fromUtf8((App::Application::getResourceDir() + "Gui/Stylesheets/overlay").c_str()); - QDir::setSearchPaths(QStringLiteral("overlay"), qssOverlayPaths); + QDir::setSearchPaths(QLatin1String("overlay"), qssOverlayPaths); } void StartupProcess::setImagePaths() @@ -334,10 +334,10 @@ void StartupPostProcess::checkOpenGL() "Please upgrade your graphics driver and/or card as required.") .arg(major) .arg(minor) - + QStringLiteral("\n"); + + QLatin1String("\n"); Base::Console().Warning(message.toStdString().c_str()); Dialog::DlgCheckableMessageBox::showMessage( - QCoreApplication::applicationName() + QStringLiteral(" - ") + QCoreApplication::applicationName() + QLatin1String(" - ") + QObject::tr("Invalid OpenGL Version"), message); } diff --git a/src/Gui/ToolBarManager.cpp b/src/Gui/ToolBarManager.cpp index 04876e39b36e..3938e675d908 100644 --- a/src/Gui/ToolBarManager.cpp +++ b/src/Gui/ToolBarManager.cpp @@ -274,7 +274,7 @@ class ToolBarAreaWidget : public QWidget auto toolbar = qobject_cast(widgetAt(i)); if (!toolbar || toolbar->objectName().isEmpty() - || toolbar->objectName().startsWith(QStringLiteral("*"))) { + || toolbar->objectName().startsWith(QLatin1String("*"))) { continue; } @@ -372,7 +372,7 @@ void ToolBarManager::setupStatusBar() if (auto sb = getMainWindow()->statusBar()) { sb->installEventFilter(this); statusBarAreaWidget = new ToolBarAreaWidget(sb, ToolBarArea::StatusBarToolBarArea, hStatusBar, connParam); - statusBarAreaWidget->setObjectName(QStringLiteral("StatusBarArea")); + statusBarAreaWidget->setObjectName(QLatin1String("StatusBarArea")); sb->insertPermanentWidget(2, statusBarAreaWidget); statusBarAreaWidget->show(); } @@ -383,11 +383,11 @@ void ToolBarManager::setupMenuBar() if (auto mb = getMainWindow()->menuBar()) { mb->installEventFilter(this); menuBarLeftAreaWidget = new ToolBarAreaWidget(mb, ToolBarArea::LeftMenuToolBarArea, hMenuBarLeft, connParam, &menuBarTimer); - menuBarLeftAreaWidget->setObjectName(QStringLiteral("MenuBarLeftArea")); + menuBarLeftAreaWidget->setObjectName(QLatin1String("MenuBarLeftArea")); mb->setCornerWidget(menuBarLeftAreaWidget, Qt::TopLeftCorner); menuBarLeftAreaWidget->show(); menuBarRightAreaWidget = new ToolBarAreaWidget(mb, ToolBarArea::RightMenuToolBarArea, hMenuBarRight, connParam, &menuBarTimer); - menuBarRightAreaWidget->setObjectName(QStringLiteral("MenuBarRightArea")); + menuBarRightAreaWidget->setObjectName(QLatin1String("MenuBarRightArea")); mb->setCornerWidget(menuBarRightAreaWidget, Qt::TopRightCorner); menuBarRightAreaWidget->show(); } @@ -506,7 +506,7 @@ QPointer createActionWidget() static QPointer actionWidget; if (!actionWidget) { actionWidget = new QWidget(getMainWindow()); - actionWidget->setObjectName(QStringLiteral("_fc_action_widget_")); + actionWidget->setObjectName(QLatin1String("_fc_action_widget_")); /* TODO This is a temporary hack until a longterm solution is found, thanks to @realthunder for this pointer. Although actionWidget has zero size, it somehow has a @@ -1084,7 +1084,7 @@ void ToolBarManager::addToMenu(QLayout* layout, QWidget* area, QMenu* menu) auto widget = layout->itemAt(i)->widget(); if (!widget || widget == area || widget->objectName().isEmpty() - || widget->objectName().startsWith(QStringLiteral("*"))) + || widget->objectName().startsWith(QLatin1String("*"))) { continue; } diff --git a/src/Gui/Widgets.cpp b/src/Gui/Widgets.cpp index 0692f9776595..6ede86412cca 100644 --- a/src/Gui/Widgets.cpp +++ b/src/Gui/Widgets.cpp @@ -858,13 +858,13 @@ void ColorButton::onRejected() UrlLabel::UrlLabel(QWidget* parent, Qt::WindowFlags f) : QLabel(parent, f) - , _url (QStringLiteral("http://localhost")) + , _url (QLatin1String("http://localhost")) , _launchExternal(true) { setToolTip(this->_url); setCursor(Qt::PointingHandCursor); if (qApp->styleSheet().isEmpty()) - setStyleSheet(QStringLiteral("Gui--UrlLabel {color: #0000FF;text-decoration: underline;}")); + setStyleSheet(QLatin1String("Gui--UrlLabel {color: #0000FF;text-decoration: underline;}")); } UrlLabel::~UrlLabel() = default; @@ -1203,7 +1203,7 @@ bool ToolTip::eventFilter(QObject* o, QEvent*e) case QEvent::Show: case QEvent::Hide: if (auto label = qobject_cast(o)) { - if (label->objectName() == QStringLiteral("qtooltip_label")) { + if (label->objectName() == QLatin1String("qtooltip_label")) { // This is a trick to circumvent that the tooltip gets hidden immediately // after it gets visible. We just filter out all timer events to keep the // label visible. diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index 6167dd4c1720..e848f37f4f11 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -3054,7 +3054,7 @@ std::shared_ptr getEnumItems(const QStringList& commonModes) // NOLI std::shared_ptr enumItems; for (auto &mode : commonModes) { ++index; - auto fields = mode.split(QStringLiteral("|")); + auto fields = mode.split(QLatin1String("|")); if (!enumItems && fields.size() <= 1) { continue; } diff --git a/src/Main/MainGui.cpp b/src/Main/MainGui.cpp index 71ed46a2ef28..31f24c744489 100644 --- a/src/Main/MainGui.cpp +++ b/src/Main/MainGui.cpp @@ -171,7 +171,7 @@ int main( int argc, char ** argv ) App::Application::Config()["SplashInfoColor" ] = "#8aadf4"; // light blue App::Application::Config()["SplashInfoPosition" ] = "6,75"; - QGuiApplication::setDesktopFileName(QStringLiteral("org.freecad.FreeCAD")); + QGuiApplication::setDesktopFileName(QLatin1String("org.freecad.FreeCAD")); try { // Init phase =========================================================== diff --git a/src/Mod/Fem/Gui/TaskPostBoxes.cpp b/src/Mod/Fem/Gui/TaskPostBoxes.cpp index f19453608a42..1cc914a994a5 100644 --- a/src/Mod/Fem/Gui/TaskPostBoxes.cpp +++ b/src/Mod/Fem/Gui/TaskPostBoxes.cpp @@ -495,7 +495,7 @@ TaskPostDataAlongLine::TaskPostDataAlongLine(ViewProviderFemPostDataAlongLine* v setupConnectionsStep1(); this->groupLayout()->addWidget(proxy); - QSize size = ui->point1X->sizeForText(QStringLiteral("000000000000")); + QSize size = ui->point1X->sizeForText(QLatin1String("000000000000")); ui->point1X->setMinimumWidth(size.width()); ui->point1Y->setMinimumWidth(size.width()); ui->point1Z->setMinimumWidth(size.width()); @@ -921,7 +921,7 @@ TaskPostDataAtPoint::TaskPostDataAtPoint(ViewProviderFemPostDataAtPoint* view, Q this->groupLayout()->addWidget(proxy); - QSize size = ui->centerX->sizeForText(QStringLiteral("000000000000")); + QSize size = ui->centerX->sizeForText(QLatin1String("000000000000")); ui->centerX->setMinimumWidth(size.width()); ui->centerY->setMinimumWidth(size.width()); ui->centerZ->setMinimumWidth(size.width()); diff --git a/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp b/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp index dd692529056e..52e3ac951547 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp @@ -451,7 +451,7 @@ BoxWidget::BoxWidget() { ui->setupUi(this); - QSize size = ui->centerX->sizeForText(QStringLiteral("000000000000")); + QSize size = ui->centerX->sizeForText(QLatin1String("000000000000")); ui->centerX->setMinimumWidth(size.width()); ui->centerY->setMinimumWidth(size.width()); ui->centerZ->setMinimumWidth(size.width()); @@ -642,7 +642,7 @@ CylinderWidget::CylinderWidget() { ui->setupUi(this); - QSize size = ui->centerX->sizeForText(QStringLiteral("000000000000")); + QSize size = ui->centerX->sizeForText(QLatin1String("000000000000")); ui->centerX->setMinimumWidth(size.width()); ui->centerY->setMinimumWidth(size.width()); ui->centerZ->setMinimumWidth(size.width()); @@ -875,7 +875,7 @@ PlaneWidget::PlaneWidget() { ui->setupUi(this); - QSize size = ui->originX->sizeForText(QStringLiteral("000000000000")); + QSize size = ui->originX->sizeForText(QLatin1String("000000000000")); ui->originX->setMinimumWidth(size.width()); ui->originY->setMinimumWidth(size.width()); ui->originZ->setMinimumWidth(size.width()); @@ -1055,7 +1055,7 @@ SphereWidget::SphereWidget() { ui->setupUi(this); - QSize size = ui->centerX->sizeForText(QStringLiteral("000000000000")); + QSize size = ui->centerX->sizeForText(QLatin1String("000000000000")); ui->centerX->setMinimumWidth(size.width()); ui->centerY->setMinimumWidth(size.width()); ui->centerZ->setMinimumWidth(size.width()); diff --git a/src/Mod/Part/Gui/TaskCheckGeometry.cpp b/src/Mod/Part/Gui/TaskCheckGeometry.cpp index fb0333edb6ea..093ad214443d 100644 --- a/src/Mod/Part/Gui/TaskCheckGeometry.cpp +++ b/src/Mod/Part/Gui/TaskCheckGeometry.cpp @@ -144,7 +144,7 @@ QString checkStatusToString(const int &index) } if (index > 33 || index < 0) { - QString message(QObject::tr("Out Of Enum Range:") + QStringLiteral(" ")); + QString message(QObject::tr("Out Of Enum Range:") + QLatin1String(" ")); QString number; number.setNum(index); message += number; @@ -1013,7 +1013,7 @@ TaskCheckGeometryDialog::TaskCheckGeometryDialog() autoRunCheckBox->setText(tr("Skip settings page")); autoRunCheckBox->setToolTip( tr("Skip this settings page and run the geometry check automatically.") - + QStringLiteral("\n") + + QLatin1String("\n") + tr("Default: false")); autoRunCheckBox->setChecked(group->GetBool("AutoRun", false)); connect(autoRunCheckBox, &QCheckBox::toggled, @@ -1072,7 +1072,7 @@ TaskCheckGeometryDialog::TaskCheckGeometryDialog() settingsBox->groupLayout()->addWidget(new QLabel(tr("\nIndividual boolean operation checks:"))); argumentTypeModeCheckBox = new QCheckBox(); - argumentTypeModeCheckBox->setText(QStringLiteral(" ") + tr("Bad type")); + argumentTypeModeCheckBox->setText(QLatin1String(" ") + tr("Bad type")); argumentTypeModeCheckBox->setToolTip(tr("Check for bad argument types. Default: true")); argumentTypeModeCheckBox->setChecked(group->GetBool("ArgumentTypeMode", true)); connect(argumentTypeModeCheckBox, &QCheckBox::toggled, @@ -1080,7 +1080,7 @@ TaskCheckGeometryDialog::TaskCheckGeometryDialog() settingsBox->groupLayout()->addWidget(argumentTypeModeCheckBox); selfInterModeCheckBox = new QCheckBox(); - selfInterModeCheckBox->setText(QStringLiteral(" ") + tr("Self-intersect")); + selfInterModeCheckBox->setText(QLatin1String(" ") + tr("Self-intersect")); selfInterModeCheckBox->setToolTip(tr("Check for self-intersections. Default: true")); selfInterModeCheckBox->setChecked(group->GetBool("SelfInterMode", true)); connect(selfInterModeCheckBox, &QCheckBox::toggled, @@ -1088,7 +1088,7 @@ TaskCheckGeometryDialog::TaskCheckGeometryDialog() settingsBox->groupLayout()->addWidget(selfInterModeCheckBox); smallEdgeModeCheckBox = new QCheckBox(); - smallEdgeModeCheckBox->setText(QStringLiteral(" ") + tr("Too small edge")); + smallEdgeModeCheckBox->setText(QLatin1String(" ") + tr("Too small edge")); smallEdgeModeCheckBox->setToolTip(tr("Check for edges that are too small. Default: true")); smallEdgeModeCheckBox->setChecked(group->GetBool("SmallEdgeMode", true)); connect(smallEdgeModeCheckBox, &QCheckBox::toggled, @@ -1096,7 +1096,7 @@ TaskCheckGeometryDialog::TaskCheckGeometryDialog() settingsBox->groupLayout()->addWidget(smallEdgeModeCheckBox); rebuildFaceModeCheckBox = new QCheckBox(); - rebuildFaceModeCheckBox->setText(QStringLiteral(" ") + tr("Nonrecoverable face")); + rebuildFaceModeCheckBox->setText(QLatin1String(" ") + tr("Nonrecoverable face")); rebuildFaceModeCheckBox->setToolTip(tr("Check for nonrecoverable faces. Default: true")); rebuildFaceModeCheckBox->setChecked(group->GetBool("RebuildFaceMode", true)); connect(rebuildFaceModeCheckBox, &QCheckBox::toggled, @@ -1104,7 +1104,7 @@ TaskCheckGeometryDialog::TaskCheckGeometryDialog() settingsBox->groupLayout()->addWidget(rebuildFaceModeCheckBox); continuityModeCheckBox = new QCheckBox(); - continuityModeCheckBox->setText(QStringLiteral(" ") + tr("Continuity")); + continuityModeCheckBox->setText(QLatin1String(" ") + tr("Continuity")); continuityModeCheckBox->setToolTip(tr("Check for continuity. Default: true")); continuityModeCheckBox->setChecked(group->GetBool("ContinuityMode", true)); connect(continuityModeCheckBox, &QCheckBox::toggled, @@ -1112,7 +1112,7 @@ TaskCheckGeometryDialog::TaskCheckGeometryDialog() settingsBox->groupLayout()->addWidget(continuityModeCheckBox); tangentModeCheckBox = new QCheckBox(); - tangentModeCheckBox->setText(QStringLiteral(" ") + tr("Incompatibility of face")); + tangentModeCheckBox->setText(QLatin1String(" ") + tr("Incompatibility of face")); tangentModeCheckBox->setToolTip(tr("Check for incompatible faces. Default: true")); tangentModeCheckBox->setChecked(group->GetBool("TangentMode", true)); connect(tangentModeCheckBox, &QCheckBox::toggled, @@ -1120,7 +1120,7 @@ TaskCheckGeometryDialog::TaskCheckGeometryDialog() settingsBox->groupLayout()->addWidget(tangentModeCheckBox); mergeVertexModeCheckBox = new QCheckBox(); - mergeVertexModeCheckBox->setText(QStringLiteral(" ") + tr("Incompatibility of vertex")); + mergeVertexModeCheckBox->setText(QLatin1String(" ") + tr("Incompatibility of vertex")); mergeVertexModeCheckBox->setToolTip(tr("Check for incompatible vertices. Default: true")); mergeVertexModeCheckBox->setChecked(group->GetBool("MergeVertexMode", true)); connect(mergeVertexModeCheckBox, &QCheckBox::toggled, @@ -1128,7 +1128,7 @@ TaskCheckGeometryDialog::TaskCheckGeometryDialog() settingsBox->groupLayout()->addWidget(mergeVertexModeCheckBox); mergeEdgeModeCheckBox = new QCheckBox(); - mergeEdgeModeCheckBox->setText(QStringLiteral(" ") + tr("Incompatibility of edge")); + mergeEdgeModeCheckBox->setText(QLatin1String(" ") + tr("Incompatibility of edge")); mergeEdgeModeCheckBox->setToolTip(tr("Check for incompatible edges. Default: true")); mergeEdgeModeCheckBox->setChecked(group->GetBool("MergeEdgeMode", true)); connect(mergeEdgeModeCheckBox, &QCheckBox::toggled, @@ -1136,7 +1136,7 @@ TaskCheckGeometryDialog::TaskCheckGeometryDialog() settingsBox->groupLayout()->addWidget(mergeEdgeModeCheckBox); curveOnSurfaceModeCheckBox = new QCheckBox(); - curveOnSurfaceModeCheckBox->setText(QStringLiteral(" ") + tr("Invalid curve on surface")); + curveOnSurfaceModeCheckBox->setText(QLatin1String(" ") + tr("Invalid curve on surface")); curveOnSurfaceModeCheckBox->setToolTip(tr("Check for invalid curves on surfaces. Default: true")); curveOnSurfaceModeCheckBox->setChecked(group->GetBool("CurveOnSurfaceMode", true)); connect(curveOnSurfaceModeCheckBox, &QCheckBox::toggled, diff --git a/src/Mod/Sketcher/Gui/Command.cpp b/src/Mod/Sketcher/Gui/Command.cpp index b52ab63a3afc..57fb0632f8e4 100644 --- a/src/Mod/Sketcher/Gui/Command.cpp +++ b/src/Mod/Sketcher/Gui/Command.cpp @@ -1133,8 +1133,8 @@ class GridSpaceAction: public QWidgetAction sizeLabel = new QLabel(); gridSizeBox = new Gui::QuantitySpinBox(); - gridSizeBox->setProperty("unit", QVariant(QStringLiteral("mm"))); - gridSizeBox->setObjectName(QStringLiteral("gridSize")); + gridSizeBox->setProperty("unit", QVariant(QLatin1String("mm"))); + gridSizeBox->setObjectName(QLatin1String("gridSize")); gridSizeBox->setMaximum(99999999.0); gridSizeBox->setMinimum(0.001); @@ -1388,8 +1388,8 @@ class SnapSpaceAction: public QWidgetAction angleLabel = new QLabel(); snapAngle = new Gui::QuantitySpinBox(); - snapAngle->setProperty("unit", QVariant(QStringLiteral("deg"))); - snapAngle->setObjectName(QStringLiteral("snapAngle")); + snapAngle->setProperty("unit", QVariant(QLatin1String("deg"))); + snapAngle->setObjectName(QLatin1String("snapAngle")); snapAngle->setMaximum(99999999.0); snapAngle->setMinimum(0); diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerArc.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerArc.h index b4ce06aa10a2..799c601af4a2 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerArc.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerArc.h @@ -324,7 +324,7 @@ class DrawSketchHandlerArc: public DrawSketchHandlerArcBase return QString::fromLatin1("Sketcher_Pointer_Create_3PointArc"); } - return QStringLiteral("None"); + return QLatin1String("None"); } std::unique_ptr createWidget() const override diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerFillet.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerFillet.h index 0fd4e1244287..5202ab3132bb 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerFillet.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerFillet.h @@ -415,7 +415,7 @@ template<> void DSHFilletController::configureToolWidget() { if (!init) { // Code to be executed only upon initialisation - QStringList names = {QStringLiteral("Fillet"), QStringLiteral("Chamfer")}; + QStringList names = {QLatin1String("Fillet"), QLatin1String("Chamfer")}; toolWidget->setComboboxElements(WCombobox::FirstCombo, names); toolWidget->setComboboxItemIcon( diff --git a/src/Mod/Sketcher/Gui/DrawSketchKeyboardManager.cpp b/src/Mod/Sketcher/Gui/DrawSketchKeyboardManager.cpp index 9f0fa9f27262..1c6c45c4c292 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchKeyboardManager.cpp +++ b/src/Mod/Sketcher/Gui/DrawSketchKeyboardManager.cpp @@ -96,7 +96,7 @@ bool DrawSketchKeyboardManager::eventFilter(QObject* object, QEvent* event) void DrawSketchKeyboardManager::detectKeyboardEventHandlingMode(QKeyEvent* keyEvent) { - QRegularExpression rx(QStringLiteral("^[0-9]$")); + QRegularExpression rx(QLatin1String("^[0-9]$")); auto match = rx.match(keyEvent->text()); if (keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Tab || keyEvent->key() == Qt::Key_Backtab diff --git a/src/Mod/Sketcher/Gui/SketcherToolDefaultWidget.cpp b/src/Mod/Sketcher/Gui/SketcherToolDefaultWidget.cpp index 59b17a89585a..c18e6349955a 100644 --- a/src/Mod/Sketcher/Gui/SketcherToolDefaultWidget.cpp +++ b/src/Mod/Sketcher/Gui/SketcherToolDefaultWidget.cpp @@ -439,16 +439,16 @@ void SketcherToolDefaultWidget::setParameterFontStyle(int parameterindex, FontSt switch (fontStyle) { case FontStyle::Italic: - parameterSpinBox->setStyleSheet(QStringLiteral("font-weight: normal;")); - parameterSpinBox->setStyleSheet(QStringLiteral("font-style: italic;")); + parameterSpinBox->setStyleSheet(QLatin1String("font-weight: normal;")); + parameterSpinBox->setStyleSheet(QLatin1String("font-style: italic;")); break; case FontStyle::Bold: - parameterSpinBox->setStyleSheet(QStringLiteral("font-style: normal;")); - parameterSpinBox->setStyleSheet(QStringLiteral("font-weight: bold;")); + parameterSpinBox->setStyleSheet(QLatin1String("font-style: normal;")); + parameterSpinBox->setStyleSheet(QLatin1String("font-weight: bold;")); break; case FontStyle::Normal: - parameterSpinBox->setStyleSheet(QStringLiteral("font-style: normal;")); - parameterSpinBox->setStyleSheet(QStringLiteral("font-weight: normal;")); + parameterSpinBox->setStyleSheet(QLatin1String("font-style: normal;")); + parameterSpinBox->setStyleSheet(QLatin1String("font-weight: normal;")); break; } diff --git a/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp b/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp index 5780c6af2f1f..aac489fd58c5 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp @@ -757,8 +757,8 @@ void ConstraintFilterList::languageChange() assert(static_cast(filterItems.size()) == count()); int i = 0; for (auto const& filterItem : filterItems) { - auto text = QStringLiteral(" ").repeated(filterItem.second - 1) - + (filterItem.second > 0 ? QStringLiteral("- ") : QStringLiteral("")) + auto text = QLatin1String(" ").repeated(filterItem.second - 1) + + (filterItem.second > 0 ? QLatin1String("- ") : QLatin1String("")) + tr(filterItem.first); item(i++)->setText(text); } diff --git a/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp b/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp index 39c63eada5b6..55b25b6bc7b6 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp @@ -1148,8 +1148,8 @@ void ElementFilterList::languageChange() assert(static_cast(filterItems.size()) == count()); int i = 0; for (auto const& filterItem : filterItems) { - auto text = QStringLiteral(" ").repeated(filterItem.second - 1) - + (filterItem.second > 0 ? QStringLiteral("- ") : QStringLiteral("")) + auto text = QLatin1String(" ").repeated(filterItem.second - 1) + + (filterItem.second > 0 ? QLatin1String("- ") : QLatin1String("")) + tr(filterItem.first); item(i++)->setText(text); } diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 1b7d7932b3e5..06e2aac2b779 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -3401,7 +3401,7 @@ void ViewProviderSketch::onCameraChanged(SoCamera* cam) viewOrientationFactor = tmpFactor; draw(); - QString cmdStr = QStringLiteral("ActiveSketch.ViewObject.TempoVis.sketchClipPlane(" + QString cmdStr = QLatin1String("ActiveSketch.ViewObject.TempoVis.sketchClipPlane(" "ActiveSketch, ActiveSketch.ViewObject.SectionView, %1)\n") .arg(tmpFactor < 0 ? QLatin1String("True") : QLatin1String("False")); Base::Interpreter().runStringObject(cmdStr.toLatin1()); diff --git a/src/Mod/Start/Gui/FileCardDelegate.cpp b/src/Mod/Start/Gui/FileCardDelegate.cpp index 9a7a2cc5a4fb..b44c76bb1412 100644 --- a/src/Mod/Start/Gui/FileCardDelegate.cpp +++ b/src/Mod/Start/Gui/FileCardDelegate.cpp @@ -112,9 +112,9 @@ void FileCardDelegate::paint(QPainter* painter, thumbnail->setFixedSize(thumbnailSize, thumbnailSize); thumbnail->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Fixed); - _widget->setProperty("state", QStringLiteral("")); + _widget->setProperty("state", QLatin1String("")); if (option.state & QStyle::State_Selected) { - _widget->setProperty("state", QStringLiteral("pressed")); + _widget->setProperty("state", QLatin1String("pressed")); if (qApp->styleSheet().isEmpty()) { QColor color = getSelectionColor(); _widget->setStyleSheet(QString::fromLatin1("QWidget#thumbnailWidget {" @@ -128,7 +128,7 @@ void FileCardDelegate::paint(QPainter* painter, } } else if (option.state & QStyle::State_MouseOver) { - _widget->setProperty("state", QStringLiteral("hovered")); + _widget->setProperty("state", QLatin1String("hovered")); if (qApp->styleSheet().isEmpty()) { QColor color = getBorderColor(); _widget->setStyleSheet(QString::fromLatin1("QWidget#thumbnailWidget {"