fix(ui): some widgets objectName are broken since the renaming pass
Description
We have the following snippet, setting the QWidget::objectName
of the qt::container::widget
used, repeated at several places (mostly in module::ui::qt
, but also in other places!)
const std::string service_id = get_id().substr(get_id().find_last_of('_') + 1);
auto container = std::dynamic_pointer_cast<sight::ui::qt::container::widget>(get_container());
QWidget* const widget = container->get_qt_container();
widget->setObjectName(QString::fromStdString(service_id));
Note: this is also used for other purposes, but this is the most common usage.
This used to work reliably, because the service::id
was something akin to
configName_integer_serviceNameSrv
.
But since we've started to snake_case
them, it's more like:
sight::namespace::config_integer_service_name_srv
So the previous snippet sets the objectName
to srv
. Which, probably, wasn't the initial intent of the code, that, I assume, wanted to extract service_name_srv
instead.
Occurrences:
File | Line |
---|---|
libs/ui/__/menu.cpp |
68 |
libs/ui/__/menubar.cpp |
60 |
libs/ui/service.cpp |
147 |
libs/ui/toolbar.cpp |
83 |
libs/viz/scene3d/render.cpp |
236 |
modules/ui/qt/icon_speed_dial.cpp |
148 |
modules/ui/qt/parameters.cpp |
138, 1192 |
modules/viz/scene3d_qt/adaptor/fiducials/point.cpp |
549 |
modules/viz/scene3d_qt/adaptor/fiducials/ruker.cpp |
932 |
⚠ There are other occurrences in subprojects ⚠
⚠ I searched for the string get_id().substr(get_id().find_last_of('_') + 1);
. There may be similar broken constructs. ⚠
NOTE: I am unsure how critical this is. I'm thus keep Severitymajor, but you may switch to Severityminor, obviously.
Steps to reproduce
Print the result of one of the get_id().substr(get_id().find_last_of('_') + 1);
mentioned above.
Functional specifications
If there is any change to the workflow, UX/UI design, screenshots, etc..., please describe it here.
Technical specifications
Details of the implementation of the fix.
Test plan
Describe how you will verify that the bug is fixed.