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

Fix miscellaneous issues and warnings #652

Merged
merged 4 commits into from
Jan 30, 2025
Merged

Conversation

azeey
Copy link
Contributor

@azeey azeey commented Jan 29, 2025

🦟 Bug fix

Summary

  • Binding loop warning in WorldStats
  • ImageDisplay warning stating that the image source is invalid
    • This happened because the provider is being initialized in LoadConfig which runs after the QML has been loaded. The solution was to move it to the constructor. However, it depends on a unique name obtained from the QML, which causes a chicken and egg problem. To fix this, I've opted for generating a random string based on a UUID number. To fix this, the QML now calls a member function of ImageDisplay to register the image provider with a unique name.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

- Binding loop warning in WorldStats
- ImageDisplay warning stating that the image source is invalid
  - This happened because the provider is being initialized in
    LoadConfig which runs after the QML has been loaded. The solution
    was to move it to the constructor. However, it depends on a unique
    name obtained from the QML, which causes a chicken and egg problem.
    To fix this, I've opted for generating a random string based on a
    UUID number.

Signed-off-by: Addisu Z. Taddese <[email protected]>
@azeey azeey requested a review from jennuine as a code owner January 29, 2025 04:40
@github-actions github-actions bot added the 🏛️ ionic Gazebo Ionic label Jan 29, 2025
@@ -51,19 +54,32 @@ class ImageDisplay::Implementation

/// \brief To provide images for QML.
public: ImageProvider *provider{nullptr};

/// \brief Holds the provider name unique to this plugin instance
public: QString providerName;
Copy link
Contributor

Choose a reason for hiding this comment

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

include <Qstring> and <QStringList>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added in ImageDisplay.hh since they are needed there as well.

@@ -95,13 +111,12 @@ void ImageDisplay::LoadConfig(const tinyxml2::XMLElement *_pluginElem)
this->PluginItem()->setProperty("showPicker", topicPicker);

if (!topic.empty())
this->OnTopic(QString::fromStdString(topic));
{
auto qTopic = QString::fromStdString(topic);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
auto qTopic = QString::fromStdString(topic);
auto qTopic = QString::fromStdString(topic);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 80ad45e

@@ -225,6 +240,7 @@ void ImageDisplay::OnTopic(const QString _topic)
/////////////////////////////////////////////////
void ImageDisplay::OnRefresh()
{
gzwarn << "OnRefresh\n";
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

@@ -249,6 +265,7 @@ void ImageDisplay::OnRefresh()
// Select first one
if (this->dataPtr->topicList.count() > 0)
this->OnTopic(this->dataPtr->topicList.at(0));
gzwarn << "TopicListChanged\n";
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

azeey added 3 commits January 29, 2025 12:19
Instead of generating a random string from a UUID, this adds a new
member function that gets called from the QML to register the image
provider with a unique name.

Signed-off-by: Addisu Z. Taddese <[email protected]>
Signed-off-by: Addisu Z. Taddese <[email protected]>
Signed-off-by: Addisu Z. Taddese <[email protected]>
@azeey
Copy link
Contributor Author

azeey commented Jan 29, 2025

The UUID implementation broke tests, so I've changed the implementation a little bit. Instead of generating a random string, the QML now calls ImageDisplay::RegisterImageProvider with its own unique name. This maintains old behavior, but still fixes the original problem.

@azeey azeey enabled auto-merge (squash) January 29, 2025 20:47
@azeey azeey merged commit 14d04ab into gazebosim:gz-gui9 Jan 30, 2025
11 checks passed
@azeey azeey deleted the fix_misc_issues branch January 30, 2025 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏛️ ionic Gazebo Ionic
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants