-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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 TabBar
and TabContainer
dragging issues
#83637
Conversation
I'm sorry, but I'm not quite sure what that means.
I'm trying to replicate this bug, but I'm unable to. Could you give instructions?
Same as above.
I'm not quite so sure about this one. Technically the disabled tab is being selected, which would make the current behavior the correct one. |
For 'Fixed TabContainer drag preview not using icon minimum size (set through its TabBar).'
The minimum size is respected in the tab itself, but not in the drag preview: For 'Fixed when dragging a tab to an empty TabBar, the tab cache is not updated, causing the tab to be drawn in the wrong area until updated.' This happens when dragging a (non disabled) tab into an empty TabBar. Sometimes it seems to not happen because the tab is immediately hovered which updates the cache, but if you drag it into a spot where its not hovered immediately it happens. Also the tab needs to not be from the first position, since the x offset will be correct anyway. For 'Fixed TabBar drag preview not changing translation after dragging.' I made sure localization was set up in my project and then I set up a keyboard shortcut to call For 'Fixed when dragging a disabled tab to an empty TabBar, the tab_selected and tab_changed signals are emitted.'
Disabled tabs never emit
If disabled tabs should send these signals, we can change all the other behaviors so it is emitted. |
Ah, I see now. We should really expose that function to
Strange, it's working fine on my end.
While disabling the BTW, I discovered a bug unrelated to this PR while testing stuff: when |
I see what you mean about the disabled tab sending the
Hmm, are you using the default language as source strings for the translation? What was happening was the
I'm getting this issue as well.
Also unrelated, I found a different bug as well: Updating (not setting) the icon texture doesn't update the minimum size or redraw. This can be seen in the editor by changing the texture's size. We should probably use |
For the current tab bug, it might be related to #50930 |
Yes, that's generally what's done when translating stuff with PO files. Now that I didn't I can reproduce it as well.
Wow, older than I imagined. Thanks for finding the report! |
Updated to emit a |
Changes look good, however, good you do one last thing? |
Changed |
Thanks! |
Seems like Godot 4.2 changes a few things internally when it comes to TabContainers and as a result tabs could not be dragged and dropped into panels, only in other TabBars. This happened most likely due to this PR godotengine/godot#83637 I also added statements with the help of `Engine.get_version_info()` to preserve compatibility with Godot 4.1. If you have any code style recommendations, let me know! Because Godot 4.2 is still in beta, perhaps we should wait until the stable version is out before merging this PR, in case they change stuff again.
Seems like Godot 4.2 changes a few things internally when it comes to TabContainers and as a result tabs could not be dragged and dropped into panels, only in other TabBars. This happened most likely due to this PR godotengine/godot#83637 I also added statements with the help of `Engine.get_version_info()` to preserve compatibility with Godot 4.1. If you have any code style recommendations, let me know! Because Godot 4.2 is still in beta, perhaps we should wait until the stable version is out before merging this PR, in case they change stuff again.
Removed code duplication between
TabBar
andTabContainer
for dragging logic.TabContainer
now uses itsTabBar
for dragging functionality.TabContainer
drag preview not using icon minimum size (set through itsTabBar
).TabBar
drag preview not changing translation after dragging.TabBar
, the tab cache is not updated, causing the tab to be drawn in the wrong area until updated.TabBar
, thetab_selected
andtab_changed
signals are emitted.TabBar
, thetab_selected
signal is emitted twice.TabContainer
not properly checking if its empty on dropping tabs (It's currently not really possible since it gets hidden without tabs, but still).TabContainer
handle the tab moving logic to reduce duplicate logic and make the code cleaner. It now also properly handles tab icons and metadata.xl_text
from tab struct since it doesn't need to be stored there anymore.TabContainer
now just uses itsTabBar
'sdrag_to_rearrange_enabled
.