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 13:09:40 +01:00
committed by Chris Hennes
parent 7abdbe0ce0
commit 2682d68809
26 changed files with 51 additions and 1 deletions

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();

View File

@@ -73,6 +73,8 @@ using DrawSketchHandlerArcBase = DrawSketchControllableHandler<DSHArcController>
class DrawSketchHandlerArc: public DrawSketchHandlerArcBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerArc)
friend DSHArcController;
friend DSHArcControllerBase;

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -78,6 +78,8 @@ using DrawSketchHandlerArcSlotBase = DrawSketchControllableHandler<DSHArcSlotCon
class DrawSketchHandlerArcSlot: public DrawSketchHandlerArcSlotBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerArcSlot)
friend DSHArcSlotController;
friend DSHArcSlotControllerBase;

View File

@@ -76,6 +76,8 @@ using DrawSketchHandlerBSplineBase = DrawSketchControllableHandler<DSHBSplineCon
class DrawSketchHandlerBSpline: public DrawSketchHandlerBSplineBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerBSpline)
friend DSHBSplineController;
friend DSHBSplineControllerBase;

View File

@@ -132,6 +132,8 @@ public:
class DrawSketchHandlerCarbonCopy: public DrawSketchHandler
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerCarbonCopy)
public:
DrawSketchHandlerCarbonCopy() = default;
~DrawSketchHandlerCarbonCopy() override

View File

@@ -68,6 +68,8 @@ using DrawSketchHandlerCircleBase = DrawSketchControllableHandler<DSHCircleContr
class DrawSketchHandlerCircle: public DrawSketchHandlerCircleBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerCircle)
friend DSHCircleController;
friend DSHCircleControllerBase;

View File

@@ -71,6 +71,8 @@ using DrawSketchHandlerEllipseBase = DrawSketchControllableHandler<DSHEllipseCon
class DrawSketchHandlerEllipse: public DrawSketchHandlerEllipseBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerEllipse)
friend DSHEllipseController;
friend DSHEllipseControllerBase;

View File

@@ -90,6 +90,8 @@ protected:
class DrawSketchHandlerExtend: public DrawSketchHandler
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerExtend)
public:
DrawSketchHandlerExtend()
: Mode(STATUS_SEEK_First)

View File

@@ -127,6 +127,8 @@ public:
class DrawSketchHandlerExternal: public DrawSketchHandler
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerExternal)
public:
DrawSketchHandlerExternal(bool alwaysReference, bool intersection)
: alwaysReference {alwaysReference}

View File

@@ -122,6 +122,8 @@ using DrawSketchHandlerFilletBase = DrawSketchControllableHandler<DSHFilletContr
class DrawSketchHandlerFillet: public DrawSketchHandlerFilletBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerFillet)
friend DSHFilletController;
friend DSHFilletControllerBase;

View File

@@ -81,6 +81,8 @@ using DrawSketchHandlerLineBase = DrawSketchControllableHandler<DSHLineControlle
class DrawSketchHandlerLine: public DrawSketchHandlerLineBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerLine)
friend DSHLineController;
friend DSHLineControllerBase;

View File

@@ -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)

View File

@@ -115,6 +115,8 @@ using DrawSketchHandlerOffsetBase = DrawSketchControllableHandler<DSHOffsetContr
class DrawSketchHandlerOffset: public DrawSketchHandlerOffsetBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerOffset)
friend DSHOffsetController;
friend DSHOffsetControllerBase;

View File

@@ -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;

View File

@@ -67,6 +67,8 @@ using DrawSketchHandlerPolygonBase = DrawSketchControllableHandler<DSHPolygonCon
class DrawSketchHandlerPolygon: public DrawSketchHandlerPolygonBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerPolygon)
friend DSHPolygonController;
friend DSHPolygonControllerBase;

View File

@@ -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;

View File

@@ -62,6 +62,8 @@ using DrawSketchHandlerRotateBase = DrawSketchControllableHandler<DSHRotateContr
class DrawSketchHandlerRotate: public DrawSketchHandlerRotateBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerRotate)
friend DSHRotateController;
friend DSHRotateControllerBase;

View File

@@ -69,6 +69,8 @@ using DrawSketchHandlerScaleBase = DrawSketchControllableHandler<DSHScaleControl
class DrawSketchHandlerScale: public DrawSketchHandlerScaleBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerScale)
friend DSHScaleController;
friend DSHScaleControllerBase;

View File

@@ -67,6 +67,8 @@ using DrawSketchHandlerSlotBase = DrawSketchControllableHandler<DSHSlotControlle
class DrawSketchHandlerSlot: public DrawSketchHandlerSlotBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerSlot)
friend DSHSlotController;
friend DSHSlotControllerBase;

View File

@@ -96,6 +96,8 @@ public:
class DrawSketchHandlerSplitting: public DrawSketchHandler
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerSplitting)
public:
DrawSketchHandlerSplitting() = default;
~DrawSketchHandlerSplitting() override

View File

@@ -66,6 +66,8 @@ using DrawSketchHandlerSymmetryBase = DrawSketchControllableHandler<DSHSymmetryC
class DrawSketchHandlerSymmetry: public DrawSketchHandlerSymmetryBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerSymmetry)
friend DSHSymmetryController;
friend DSHSymmetryControllerBase;

View File

@@ -69,6 +69,8 @@ using DrawSketchHandlerTranslateBase = DrawSketchControllableHandler<DSHTranslat
class DrawSketchHandlerTranslate: public DrawSketchHandlerTranslateBase
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerTranslate)
friend DSHTranslateController;
friend DSHTranslateControllerBase;

View File

@@ -84,6 +84,8 @@ public:
class DrawSketchHandlerTrimming: public DrawSketchHandler
{
Q_DECLARE_TR_FUNCTIONS(SketcherGui::DrawSketchHandlerTrimming)
public:
DrawSketchHandlerTrimming() = default;
~DrawSketchHandlerTrimming() override