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

Use SplitView from QtQuick.Controls 2 for GzSplit #651

Merged
merged 5 commits into from
Feb 5, 2025

Conversation

azeey
Copy link
Contributor

@azeey azeey commented Jan 29, 2025

🎉 New feature

Toward #586

Summary

The SplitView from QtQuick.Controls 1 has been deprecated for a while and has been removed from Qt6. This change is a stepping stone for migrating to Qt6.

The new SplitView is significantly different from the previous one and so major changes had to be made. The original GzSplit component was also designed with more capabilities in mind for the future, which complicated the code. This has been simplified:

  • Instead of determining whether to add a new split for each card added, two splits are hard coded: (1) the main view port (2) the side panel. For every new card added, the code simply checks adds the card to the main view port if its empty. Otherwise, it puts it in the side panel.

  • Animations have been removed. It was difficult to get consistent behavior with different split sizes.

  • Card items are returned instead of their names when calling addCard. This simplifies the code that searches for items by name

  • Logic to detect if cards have been collapsed manually by resizing the card has been removed. It's not clear if it is even possible to do this with any of the cards/plugins in Gazebo since the minimumHeight constraint would prevent resizing the cards that small.

New SplitView
image

Old SplitView
image

Test it

  • gz gui -c examples/config/layout.config
  • gz sim camera_sensor.sdf

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.

The one from QtQuick.Controls 1 has been deprecated for a while and has
been removed from Qt6. This change is a stepping stone for migrating to
Qt6.

The new SplitView is significantly different from the previous one and
so major changes had to be made. The original GzSplit component was also
designed with more capabilities in mind for the future, which
complicated the code. This has been simplified:

* Instead of determining whether to add a new split for each card added, two splits
are hard coded: (1) the main view port (2) the side panel. For every new
card added, the code simply checks adds the card to the main view port
if its empty. Otherwise, it puts it in the side panel.

* Animations have been removed. It was difficult to get consistent
behavior with different split sizes.

* Card items are returned instead of their names when calling `addCard`.
This simplifies the code that searches for items by name

* Logic to detect if cards have been collapsed manually by resizing the
card has been removed. It's not clear if it is even possible to do this
with any of the cards/plugins in Gazebo since the `minimumHeight`
constraint would prevent resizing the cards that small.

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
@azeey azeey requested a review from jennuine as a code owner January 29, 2025 00:33
@github-actions github-actions bot added the 🪵 jetty Gazebo Jetty label Jan 29, 2025
Copy link
Contributor

@iche033 iche033 left a comment

Choose a reason for hiding this comment

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

Nice! works great for me. Not sure if it's possible to make the split view handle thinner or change its color to gray but those are minor details that can come later.


// Add card to main window
cardItem->setParentItem(splitItem);
// gzdbg << "Adding to:" << splitItem.toString().toStdString() << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

remove?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

/**
* Minimum width of the card pane
*/
property int cardMinimumWidth: 250;
property alias cardMinimumWidth: content.minimumWidth;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this we need to update the test for this change:

  /github/workspace/src/Plugin_TEST.cc:304: Failure
  Expected equality of these values:
    propElem->Attribute("type")
      Which is: "double"
    pluginTypes[propElem->Attribute("key")]
      Which is: "int"

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 2570a75

I opted to ignore card* properties from being parsed from XML since that wasn't working anyway. Looking at the implementation, I don't think they were intended to be exposed since they are updated internally to collapse/expand the card.

The MainWindow_TEST was failing because the requested size of the window
was below the minimum allowed size.

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
@azeey
Copy link
Contributor Author

azeey commented Jan 31, 2025

Nice! works great for me. Not sure if it's possible to make the split view handle thinner or change its color to gray but those are minor details that can come later.

It's possible to change the color and make it thinner, but it causes the mouse area to become thinner as well, which makes it really hard to use. The previous version had a wider mouse area with a thin (1px wide) rectangle display. With the SplitView in QtQuick.Control2, it's not possible to control the mouse area and the displayed rectangle independently.

2570a75 also fixes a failing test in UNIT_MainWindow_TEST. The test was requesting to resize the window to a size below the minimum size set in

minimumWidth: 300
minimumHeight: 300
, so I'm not sure how it was working in the first place.

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
@iche033
Copy link
Contributor

iche033 commented Feb 4, 2025

the noble build picked up some weird warnings:

[GNU C Compiler (gcc)] [-ERROR-] - '/home/jenkins/workspace/gz_gui-ci-pr_any-noble-amd64/build/file:/usr/lib/x86_64-linux-gnu/qt5/qml/QtQuick/Controls.2/Material/SplitView.qml' file not found

@azeey
Copy link
Contributor Author

azeey commented Feb 4, 2025

the noble build picked up some weird warnings:

Not sure wht's going on. I can't reproduce this locally. I'm going to try to retrigger the job to see if it happens consistently.

@azeey
Copy link
Contributor Author

azeey commented Feb 4, 2025

It's possible to change the color and make it thinner, but it causes the mouse area to become thinner as well, which makes it really hard to use.

There's a bug reported on this (https://bugreports.qt.io/browse/QTBUG-122929), and there's a workaround in qt6, so will take a look again after we migrate.

azeey added 2 commits February 4, 2025 12:15
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Copy link

codecov bot commented Feb 4, 2025

Codecov Report

Attention: Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 68.70%. Comparing base (8edf24d) to head (c5ea53f).
Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
src/Plugin.cc 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #651      +/-   ##
==========================================
+ Coverage   68.49%   68.70%   +0.21%     
==========================================
  Files          38       38              
  Lines        5567     5532      -35     
==========================================
- Hits         3813     3801      -12     
+ Misses       1754     1731      -23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@azeey
Copy link
Contributor Author

azeey commented Feb 4, 2025

the noble build picked up some weird warnings:

Fixed in c5ea53f

@azeey azeey merged commit daf1a6c into gazebosim:main Feb 5, 2025
12 checks passed
@azeey azeey deleted the splitview2 branch February 5, 2025 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪵 jetty Gazebo Jetty
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants