Skip to content

Commit

Permalink
Merge branch 'muh-html-formatting' into 'master'
Browse files Browse the repository at this point in the history
FIX: tooltips lose some of the relevant information if not stored as a QString

See merge request OpenMW/openmw!4513
  • Loading branch information
Capostrophic committed Jan 13, 2025
2 parents 7d47b22 + bc3c3bb commit df681a0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
38 changes: 19 additions & 19 deletions apps/opencs/view/render/instancemode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,6 @@
#include "pagedworldspacewidget.hpp"
#include "worldspacewidget.hpp"

namespace
{
constexpr std::string_view sInstanceModeTooltip = R"(
Instance editing
<ul><li>Use {scene-select-primary} and {scene-select-secondary} to select and unselect instances</li>
<li>Use {scene-edit-primary} to manipulate instances</li>
<li>Use {scene-select-tertiary} to select a reference object and then {scene-edit-secondary} to snap
selection relative to the reference object</li>
<li>Use {scene-submode-move}, {scene-submode-rotate}, {scene-submode-scale} to change to move, rotate, and
scale modes respectively</li>
<li>Use {scene-axis-x}, {scene-axis-y}, and {scene-axis-z} to lock changes to X, Y, and Z axes
respectively</li>
<li>Use {scene-delete} to delete currently selected objects</li>
<li>Use {scene-duplicate} to duplicate instances</li>
<li>Use {scene-instance-drop} to drop instances</li></ul>
)";
}

int CSVRender::InstanceMode::getSubModeFromId(const std::string& id) const
{
return id == "move" ? 0 : (id == "rotate" ? 1 : 2);
Expand Down Expand Up @@ -312,10 +294,28 @@ void CSVRender::InstanceMode::setDragAxis(const char axis)
mDragAxis = newDragAxis;
}

QString CSVRender::InstanceMode::getTooltip()
{
return QString(
"Instance editing"
"<ul><li>Use {scene-select-primary} and {scene-select-secondary} to select and unselect instances</li>"
"<li>Use {scene-edit-primary} to manipulate instances</li>"
"<li>Use {scene-select-tertiary} to select a reference object and then {scene-edit-secondary} to snap "
"selection relative to the reference object</li>"
"<li>Use {scene-submode-move}, {scene-submode-rotate}, {scene-submode-scale} to change to move, "
"rotate, and "
"scale modes respectively</li>"
"<li>Use {scene-axis-x}, {scene-axis-y}, and {scene-axis-z} to lock changes to X, Y, and Z axes "
"respectively</li>"
"<li>Use {scene-delete} to delete currently selected objects</li>"
"<li>Use {scene-duplicate} to duplicate instances</li>"
"<li>Use {scene-instance-drop} to drop instances</li></ul>");
}

CSVRender::InstanceMode::InstanceMode(
WorldspaceWidget* worldspaceWidget, osg::ref_ptr<osg::Group> parentNode, QWidget* parent)
: EditMode(worldspaceWidget, Misc::ScalableIcon::load(":scenetoolbar/editing-instance"),
Mask_Reference | Mask_Terrain, sInstanceModeTooltip.data(), parent)
Mask_Reference | Mask_Terrain, getTooltip(), parent)
, mSubMode(nullptr)
, mSubModeId("move")
, mSelectionMode(nullptr)
Expand Down
1 change: 1 addition & 0 deletions apps/opencs/view/render/instancemode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ namespace CSVRender
std::vector<osg::Vec3> mObjectsAtDragStart;
CSMWorld::IdTable* mSelectionGroups;

QString getTooltip();
int getSubModeFromId(const std::string& id) const;

osg::Vec3 quatToEuler(const osg::Quat& quat) const;
Expand Down

0 comments on commit df681a0

Please sign in to comment.