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

Allow no tabs to be selected in TabBar and TabContainer #8233

Closed
kitbdev opened this issue Oct 22, 2023 · 0 comments · Fixed by godotengine/godot#87194
Closed

Allow no tabs to be selected in TabBar and TabContainer #8233

kitbdev opened this issue Oct 22, 2023 · 0 comments · Fixed by godotengine/godot#87194
Milestone

Comments

@kitbdev
Copy link

kitbdev commented Oct 22, 2023

Describe the project you are working on

Godot Editor

Describe the problem or limitation you are having in your project

In an effort to get the bottom panel to have more functionality like regular docks do, for #4565 and #7156.
I was trying to make the Bottom Panel use a TabBar instead of an HBoxContainer of buttons, but I realized the bottom panel needs to be collapsible and be able to have no tabs selected.

The plan is to first make it use TabBar since there is a plugin API change for add_bottom_panel_item.
Then it will be changed to use a TabContainer once it gets some other features like #2250 and godotengine/godot#82468.

However, if we don't want Bottom Panel to use TabBar or break the current API, then the needed functionality can be implemented in different ways instead.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

TabBar and TabContainer would have an optional setting that allows no tabs to be selected. When a selected tab is clicked, it deselects.

Only the tab header would be shown when there are no tabs selected.

This will let the Bottom Panel shrink with clip_tabs for #7156 and situations with lots of bottom panel items. It will also allow the tabs to be rearranged with drag_to_rearrange_enabled (only within Bottom Panel at first).

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

TabBar would have a allow_deselection (or toggle_tabs?) field that when enabled allows no tabs to be selected.
When clicking on the current tab, current_tab gets set to -1.
The tab_changed signal should be emitted when this happens.

For TabContainer, when current_tab is -1 hide all child's content.

If this enhancement will not be used often, can it be worked around with a few lines of script?

Not really, you would have to re-implement TabBar.

Is there a reason why this should be core and not an add-on in the asset library?

It's for the editor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants