Add expand / collapse support to TreeView#7411
Add expand / collapse support to TreeView#7411MiriShulman wants to merge 4 commits intoisl-org:mainfrom
Conversation
|
Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes. |
There was a problem hiding this comment.
Pull request overview
This PR adds programmatic expand/collapse functionality to the TreeView component, addressing the lack of a public API to control TreeView state. This change enables application logic and Python bindings to control tree expansion states.
Changes:
- Added
Expand()andCollapse()methods to TreeView API - Exposed new methods to Python bindings
- Added C++ test suite with GUI smoke test
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| cpp/open3d/visualization/gui/TreeView.h | Declares new Expand() and Collapse() public methods |
| cpp/open3d/visualization/gui/TreeView.cpp | Implements expand/collapse logic using optional expanded state tracking |
| cpp/pybind/visualization/gui/gui.cpp | Exposes new methods to Python bindings |
| cpp/tests/visualization/TreeViewTest.cpp | Adds GUI smoke test for TreeView |
| cpp/tests/visualization/CMakeLists.txt | Adds TreeViewTest executable configuration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (it != impl_->id2item_.end()) { | ||
| it->second->expanded = true; | ||
| } | ||
| // Invalidate(); |
There was a problem hiding this comment.
Commented-out Invalidate() call should either be removed or uncommented with explanation. If invalidation is needed for proper UI updates after expansion, this should be active. If not needed, the comment should be removed to avoid confusion.
| // Invalidate(); | |
| Invalidate(); // Ensure UI is updated after expanding an item. |
| add_executable(TreeViewTest | ||
| TreeViewTest.cpp | ||
| ) |
There was a problem hiding this comment.
TreeViewTest is configured as a standalone executable rather than integrated with the test framework. Consider using the existing test infrastructure (similar to the rendering tests guarded by BUILD_GUI) to ensure this test runs as part of the automated test suite and reports results properly.
ssheorey
left a comment
There was a problem hiding this comment.
Thanks for this new feature @MiriShulman !
Please check the highlighted copilot comment.
| add_executable(TreeViewTest | ||
| TreeViewTest.cpp | ||
| ) |
Type
Motivation and Context
TreeViewcurrently does not expose a public API to programmatically expand or collapse items.This makes it difficult to control TreeView state from application logic and from Python bindings.
This PR adds explicit
Expand()andCollapse()methods to address this limitation.Description of the Changes
Expand(ItemId)andCollapse(ItemId)methods togui::TreeViewTesting
Notes