diff --git a/src/Mod/PartDesign/App/FeatureHelix.cpp b/src/Mod/PartDesign/App/FeatureHelix.cpp index cf0e726353..cc77422642 100644 --- a/src/Mod/PartDesign/App/FeatureHelix.cpp +++ b/src/Mod/PartDesign/App/FeatureHelix.cpp @@ -80,40 +80,40 @@ Helix::Helix() const char* group = "Helix"; ADD_PROPERTY_TYPE(Base, (Base::Vector3d(0.0, 0.0, 0.0)), group, App::Prop_ReadOnly, - "The center point of the helix' start; derived from the reference axis."); + QT_TRANSLATE_NOOP("App::Property", "The center point of the helix' start; derived from the reference axis.")); ADD_PROPERTY_TYPE(Axis, (Base::Vector3d(0.0, 1.0, 0.0)), group, App::Prop_ReadOnly, - "The helix' direction; derived from the reference axis."); + QT_TRANSLATE_NOOP("App::Property", "The helix' direction; derived from the reference axis.")); ADD_PROPERTY_TYPE(ReferenceAxis, (0), group, App::Prop_None, - "The reference axis of the helix."); + QT_TRANSLATE_NOOP("App::Property", "The reference axis of the helix.")); ADD_PROPERTY_TYPE(Mode, (long(initialMode)), group, App::Prop_None, - "The helix input mode specifies which properties are set by the user.\n" - "Dependent properties are then calculated."); + QT_TRANSLATE_NOOP("App::Property", "The helix input mode specifies which properties are set by the user.\n" + "Dependent properties are then calculated.")); Mode.setEnums(ModeEnums); ADD_PROPERTY_TYPE(Pitch, (10.0), group, App::Prop_None, - "The axial distance between two turns."); + QT_TRANSLATE_NOOP("App::Property", "The axial distance between two turns.")); ADD_PROPERTY_TYPE(Height, (30.0), group, App::Prop_None, - "The height of the helix' path, not accounting for the extent of the profile."); + QT_TRANSLATE_NOOP("App::Property", "The height of the helix' path, not accounting for the extent of the profile.")); ADD_PROPERTY_TYPE(Turns, (3.0), group, App::Prop_None, - "The number of turns in the helix."); + QT_TRANSLATE_NOOP("App::Property", "The number of turns in the helix.")); Turns.setConstraints(&floatTurns); ADD_PROPERTY_TYPE(Angle, (0.0), group, App::Prop_None, - "The angle of the cone that forms a hull around the helix.\n" - "Non-zero values turn the helix into a conical spiral.\n" - "Positive values make the radius grow, nevatige shrink."); + QT_TRANSLATE_NOOP("App::Property", "The angle of the cone that forms a hull around the helix.\n" + "Non-zero values turn the helix into a conical spiral.\n" + "Positive values make the radius grow, nevatige shrink.")); Angle.setConstraints(&floatAngle); ADD_PROPERTY_TYPE(Growth, (0.0), group, App::Prop_None, - "The growth of the helix' radius per turn.\n" - "Non-zero values turn the helix into a conical spiral."); + QT_TRANSLATE_NOOP("App::Property", "The growth of the helix' radius per turn.\n" + "Non-zero values turn the helix into a conical spiral.")); ADD_PROPERTY_TYPE(LeftHanded, (false), group, App::Prop_None, - "Sets the turning direction to left handed,\n" - "i.e. counter-clockwise when moving along its axis."); + QT_TRANSLATE_NOOP("App::Property", "Sets the turning direction to left handed,\n" + "i.e. counter-clockwise when moving along its axis.")); ADD_PROPERTY_TYPE(Reversed, (false), group, App::Prop_None, - "Determines whether the helix points in the opposite direction of the axis."); + QT_TRANSLATE_NOOP("App::Property", "Determines whether the helix points in the opposite direction of the axis.")); ADD_PROPERTY_TYPE(Outside, (false), group, App::Prop_None, - "If set, the result will be the intersection of the profile and the preexisting body."); + QT_TRANSLATE_NOOP("App::Property", "If set, the result will be the intersection of the profile and the preexisting body.")); ADD_PROPERTY_TYPE(HasBeenEdited, (false), group, App::Prop_Hidden, - "If false, the tool will propose an initial value for the pitch based on the profile bounding box,\n" - "so that self intersection is avoided."); + QT_TRANSLATE_NOOP("App::Property", "If false, the tool will propose an initial value for the pitch based on the profile bounding box,\n" + "so that self intersection is avoided.")); setReadWriteStatusForMode(initialMode); } diff --git a/src/Mod/PartDesign/Gui/TaskHelixParameters.cpp b/src/Mod/PartDesign/Gui/TaskHelixParameters.cpp index 6e9034262b..1360ee6761 100644 --- a/src/Mod/PartDesign/Gui/TaskHelixParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskHelixParameters.cpp @@ -301,9 +301,13 @@ void TaskHelixParameters::updateStatus() void TaskHelixParameters::updateUI() { fillAxisCombo(); - + assignToolTipsFromPropertyDocs(); updateStatus(); + adaptVisibilityToMode(); +} +void TaskHelixParameters::adaptVisibilityToMode() +{ bool isPitchVisible = false; bool isHeightVisible = false; bool isTurnsVisible = false; @@ -358,6 +362,52 @@ void TaskHelixParameters::updateUI() ui->checkBoxOutside->setVisible(isOutsideVisible); } +void TaskHelixParameters::assignToolTipsFromPropertyDocs() +{ + auto pcHelix = static_cast(vp->getObject()); + const char* propCategory = "App::Property"; // cf. https://tracker.freecadweb.org/view.php?id=0002524 + QString toolTip; + + // Beware that "Axis" in the GUI actually represents the property "ReferenceAxis"! + // The property "Axis" holds only the directional part of the reference axis and has no corresponding GUI element. + toolTip = QApplication::translate(propCategory, pcHelix->ReferenceAxis.getDocumentation()); + ui->axis->setToolTip(toolTip); + ui->labelAxis->setToolTip(toolTip); + + toolTip = QApplication::translate(propCategory, pcHelix->Mode.getDocumentation()); + ui->inputMode->setToolTip(toolTip); + ui->labelInputMode->setToolTip(toolTip); + + toolTip = QApplication::translate(propCategory, pcHelix->Pitch.getDocumentation()); + ui->pitch->setToolTip(toolTip); + ui->labelPitch->setToolTip(toolTip); + + toolTip = QApplication::translate(propCategory, pcHelix->Height.getDocumentation()); + ui->height->setToolTip(toolTip); + ui->labelHeight->setToolTip(toolTip); + + toolTip = QApplication::translate(propCategory, pcHelix->Turns.getDocumentation()); + ui->turns->setToolTip(toolTip); + ui->labelTurns->setToolTip(toolTip); + + toolTip = QApplication::translate(propCategory, pcHelix->Angle.getDocumentation()); + ui->coneAngle->setToolTip(toolTip); + ui->labelConeAngle->setToolTip(toolTip); + + toolTip = QApplication::translate(propCategory, pcHelix->Growth.getDocumentation()); + ui->growth->setToolTip(toolTip); + ui->labelGrowth->setToolTip(toolTip); + + toolTip = QApplication::translate(propCategory, pcHelix->LeftHanded.getDocumentation()); + ui->checkBoxLeftHanded->setToolTip(toolTip); + + toolTip = QApplication::translate(propCategory, pcHelix->Reversed.getDocumentation()); + ui->checkBoxReversed->setToolTip(toolTip); + + toolTip = QApplication::translate(propCategory, pcHelix->Outside.getDocumentation()); + ui->checkBoxOutside->setToolTip(toolTip); +} + void TaskHelixParameters::onSelectionChanged(const Gui::SelectionChanges& msg) { if (msg.Type == Gui::SelectionChanges::AddSelection) { @@ -529,6 +579,7 @@ void TaskHelixParameters::changeEvent(QEvent* e) int axis = ui->axis->currentIndex(); int mode = ui->inputMode->currentIndex(); ui->retranslateUi(proxy); + assignToolTipsFromPropertyDocs(); // Axes added by the user cannot be restored fillAxisCombo(true); diff --git a/src/Mod/PartDesign/Gui/TaskHelixParameters.h b/src/Mod/PartDesign/Gui/TaskHelixParameters.h index 02b9cdddd0..b7c5c1dbd2 100644 --- a/src/Mod/PartDesign/Gui/TaskHelixParameters.h +++ b/src/Mod/PartDesign/Gui/TaskHelixParameters.h @@ -69,6 +69,8 @@ private: void addSketchAxes(); void addPartAxes(); int addCurrentLink(); + void assignToolTipsFromPropertyDocs(); + void adaptVisibilityToMode(); private Q_SLOTS: void onPitchChanged(double); diff --git a/src/Mod/PartDesign/Gui/TaskHelixParameters.ui b/src/Mod/PartDesign/Gui/TaskHelixParameters.ui index ff22ee13b6..434f79a473 100644 --- a/src/Mod/PartDesign/Gui/TaskHelixParameters.ui +++ b/src/Mod/PartDesign/Gui/TaskHelixParameters.ui @@ -35,7 +35,7 @@ - + Axis: @@ -88,7 +88,7 @@ - + Mode: