Sketcher: Use correct namespace for tr functions in DSH

The `lupdate` tool from Qt used to extract translations from files was
not in sync with what the macros defined in the code. The mismatch came
from two places:

1. The DrawSketchHandeler used non fully-qualified name for the
   context whereas lupdate assumed the FQN.
2. Deriving DrawSketchHandlers did not override the translate method
   context to their own class names while lupdate assumed that they do.

While it's not fully clear if what `lupdate` does here is correct
(it's a lot of assumptions) it's way easier to fix our metadata than
fight with lupdate.
This commit is contained in:
Kacper Donat
2026-01-05 07:42:59 -09:00
committed by Chris Hennes
parent 7abdbe0ce0
commit 2682d68809
26 changed files with 51 additions and 1 deletions
+1 -1
View File
@@ -158,7 +158,7 @@ private:
*/
class SketcherGuiExport DrawSketchHandler: public Gui::ToolHandler
{
Q_DECLARE_TR_FUNCTIONS(DrawSketchHandler)
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandler)
public:
DrawSketchHandler();
@@ -73,6 +73,8 @@ using DrawSketchHandlerArcBase = DrawSketchControllableHandler<DSHArcController>
class DrawSketchHandlerArc: public DrawSketchHandlerArcBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerArc)
friend DSHArcController;
friend DSHArcControllerBase;
@@ -46,6 +46,8 @@ extern GeometryCreationMode geometryCreationMode; // defined in CommandCreateGe
class DrawSketchHandlerArcOfEllipse: public DrawSketchHandler
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerArcOfEllipse)
public:
DrawSketchHandlerArcOfEllipse()
: Mode(STATUS_SEEK_First)
@@ -48,6 +48,8 @@ extern GeometryCreationMode geometryCreationMode; // defined in CommandCreateGe
class DrawSketchHandlerArcOfHyperbola: public DrawSketchHandler
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerArcOfHyperbola)
public:
DrawSketchHandlerArcOfHyperbola()
: Mode(STATUS_SEEK_First)
@@ -48,6 +48,8 @@ extern GeometryCreationMode geometryCreationMode; // defined in CommandCreateGe
class DrawSketchHandlerArcOfParabola: public DrawSketchHandler
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerArcOfParabola)
public:
DrawSketchHandlerArcOfParabola()
: Mode(STATUS_SEEK_First)
@@ -78,6 +78,8 @@ using DrawSketchHandlerArcSlotBase = DrawSketchControllableHandler<DSHArcSlotCon
class DrawSketchHandlerArcSlot: public DrawSketchHandlerArcSlotBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerArcSlot)
friend DSHArcSlotController;
friend DSHArcSlotControllerBase;
@@ -76,6 +76,8 @@ using DrawSketchHandlerBSplineBase = DrawSketchControllableHandler<DSHBSplineCon
class DrawSketchHandlerBSpline: public DrawSketchHandlerBSplineBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerBSpline)
friend DSHBSplineController;
friend DSHBSplineControllerBase;
@@ -132,6 +132,8 @@ public:
class DrawSketchHandlerCarbonCopy: public DrawSketchHandler
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerCarbonCopy)
public:
DrawSketchHandlerCarbonCopy() = default;
~DrawSketchHandlerCarbonCopy() override
@@ -68,6 +68,8 @@ using DrawSketchHandlerCircleBase = DrawSketchControllableHandler<DSHCircleContr
class DrawSketchHandlerCircle: public DrawSketchHandlerCircleBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerCircle)
friend DSHCircleController;
friend DSHCircleControllerBase;
@@ -71,6 +71,8 @@ using DrawSketchHandlerEllipseBase = DrawSketchControllableHandler<DSHEllipseCon
class DrawSketchHandlerEllipse: public DrawSketchHandlerEllipseBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerEllipse)
friend DSHEllipseController;
friend DSHEllipseControllerBase;
@@ -90,6 +90,8 @@ protected:
class DrawSketchHandlerExtend: public DrawSketchHandler
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerExtend)
public:
DrawSketchHandlerExtend()
: Mode(STATUS_SEEK_First)
@@ -127,6 +127,8 @@ public:
class DrawSketchHandlerExternal: public DrawSketchHandler
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerExternal)
public:
DrawSketchHandlerExternal(bool alwaysReference, bool intersection)
: alwaysReference {alwaysReference}
@@ -122,6 +122,8 @@ using DrawSketchHandlerFilletBase = DrawSketchControllableHandler<DSHFilletContr
class DrawSketchHandlerFillet: public DrawSketchHandlerFilletBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerFillet)
friend DSHFilletController;
friend DSHFilletControllerBase;
@@ -81,6 +81,8 @@ using DrawSketchHandlerLineBase = DrawSketchControllableHandler<DSHLineControlle
class DrawSketchHandlerLine: public DrawSketchHandlerLineBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerLine)
friend DSHLineController;
friend DSHLineControllerBase;
@@ -51,6 +51,8 @@ extern GeometryCreationMode geometryCreationMode; // defined in CommandCreateGe
class DrawSketchHandlerLineSet: public DrawSketchHandler
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerLineSet)
public:
DrawSketchHandlerLineSet()
: Mode(STATUS_SEEK_First)
@@ -115,6 +115,8 @@ using DrawSketchHandlerOffsetBase = DrawSketchControllableHandler<DSHOffsetContr
class DrawSketchHandlerOffset: public DrawSketchHandlerOffsetBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerOffset)
friend DSHOffsetController;
friend DSHOffsetControllerBase;
@@ -58,6 +58,8 @@ using DrawSketchHandlerPointBase = DrawSketchControllableHandler<DSHPointControl
class DrawSketchHandlerPoint: public DrawSketchHandlerPointBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerPoint)
// Allow specialisations of controllers access to private members
friend DSHPointController;
@@ -67,6 +67,8 @@ using DrawSketchHandlerPolygonBase = DrawSketchControllableHandler<DSHPolygonCon
class DrawSketchHandlerPolygon: public DrawSketchHandlerPolygonBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerPolygon)
friend DSHPolygonController;
friend DSHPolygonControllerBase;
@@ -80,6 +80,8 @@ using DrawSketchHandlerRectangleBase = DrawSketchControllableHandler<DSHRectangl
class DrawSketchHandlerRectangle: public DrawSketchHandlerRectangleBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerRectangle)
// Allow specialisations of controllers access to private members
friend DSHRectangleController;
friend DSHRectangleControllerBase;
@@ -62,6 +62,8 @@ using DrawSketchHandlerRotateBase = DrawSketchControllableHandler<DSHRotateContr
class DrawSketchHandlerRotate: public DrawSketchHandlerRotateBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerRotate)
friend DSHRotateController;
friend DSHRotateControllerBase;
@@ -69,6 +69,8 @@ using DrawSketchHandlerScaleBase = DrawSketchControllableHandler<DSHScaleControl
class DrawSketchHandlerScale: public DrawSketchHandlerScaleBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerScale)
friend DSHScaleController;
friend DSHScaleControllerBase;
@@ -67,6 +67,8 @@ using DrawSketchHandlerSlotBase = DrawSketchControllableHandler<DSHSlotControlle
class DrawSketchHandlerSlot: public DrawSketchHandlerSlotBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerSlot)
friend DSHSlotController;
friend DSHSlotControllerBase;
@@ -96,6 +96,8 @@ public:
class DrawSketchHandlerSplitting: public DrawSketchHandler
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerSplitting)
public:
DrawSketchHandlerSplitting() = default;
~DrawSketchHandlerSplitting() override
@@ -66,6 +66,8 @@ using DrawSketchHandlerSymmetryBase = DrawSketchControllableHandler<DSHSymmetryC
class DrawSketchHandlerSymmetry: public DrawSketchHandlerSymmetryBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerSymmetry)
friend DSHSymmetryController;
friend DSHSymmetryControllerBase;
@@ -69,6 +69,8 @@ using DrawSketchHandlerTranslateBase = DrawSketchControllableHandler<DSHTranslat
class DrawSketchHandlerTranslate: public DrawSketchHandlerTranslateBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerTranslate)
friend DSHTranslateController;
friend DSHTranslateControllerBase;
@@ -84,6 +84,8 @@ public:
class DrawSketchHandlerTrimming: public DrawSketchHandler
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerTrimming)
public:
DrawSketchHandlerTrimming() = default;
~DrawSketchHandlerTrimming() override