Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly map ImageManager list model index to topic vector #46

Merged
merged 3 commits into from
Sep 19, 2022

Conversation

Kettenhoax
Copy link
Contributor

Most functions of ImageManager interpret index 0 as unselected and map indices > 0 to the actual topics.
This PR does the same in getImageTopic.

Fixes #45

Marcel Zeilinger and others added 2 commits September 15, 2022 20:39
Copy link
Member

@ijnek ijnek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Kettenhoax for finding the bug and proposing the fix! I have added a test that confirms the behaviour change. Please tell me if it looks good to you, and we can get it merged and backported!

@@ -154,7 +154,6 @@ std::optional<ImageTopic> ImageManager::getImageTopic(unsigned index)
void ImageManager::addImageTopicExplicitly(ImageTopic imageTopic)
{
beginResetModel();
imageTopics.clear();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this change intentionally been added to this PR? It seems like it fixes a different issue.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, this was intentional. With the test I added, I couldn't call addImageTopicExplicitly consecutively because the second call clears the topic added by the first call.

As I didn't see a point in having it there, (and so it actually "adds" the image topic, rather than clearing-then-adding).

rqt_image_overlay/test/test_image_manager.cpp Show resolved Hide resolved
Signed-off-by: Kenji Brameld <kenjibrameld@gmail.com>
@ijnek
Copy link
Member

ijnek commented Sep 19, 2022

Going to merge once CI passes.

@ijnek
Copy link
Member

ijnek commented Sep 19, 2022

Goingto merge, as build failure seems related to ros-sports/ros_image_to_qimage#23

@ijnek ijnek merged commit e5d4504 into ros-sports:rolling Sep 19, 2022
@ijnek
Copy link
Member

ijnek commented Sep 19, 2022

@Mergifyio backport galactic humble

@mergify
Copy link

mergify bot commented Sep 19, 2022

backport galactic humble

✅ Backports have been created

ijnek added a commit that referenced this pull request Sep 19, 2022
Correctly map ImageManager list model index to topic vector (backport #46)
ijnek added a commit that referenced this pull request Sep 19, 2022
Correctly map ImageManager list model index to topic vector (backport #46)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

save_settings doesn't store the selected topic
2 participants