-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
GUI: Inconsistent order of SpinBox
value change and control pressing / item selection signals
#79695
Comments
Looks like this is a
Lines 387 to 390 in 0c2144d
|
SpinBox
value change and control pressing / item selection signals
I quite agree.
If both the data and the UI are updated in the receiving method, we can just defer the UI update call in the receiving method. |
I just ran into this. A SpinBox that's part of a Dialog will process losing focus after its ancestor Dialog's 'canceled' signal if you close that Dialog with the X button (in my case, even if that 'canceled' signal handler was itself deferred). So trying to reset the SpinBox's value in the 'canceled' handler won't work as it will get overwritten by its text. A dirty workaround I've found is to do something weird like |
Godot version
v4.1.1.stable.official [bd6af8e]
System information
Kubuntu 23.04
Issue description
There is an inconsistency in the order of losing focus / applying a field value (
LineEdit
,TextEdit
,SpinBox
) and receiving focus / pressing a control (Button
,Tree
,ItemList
).In the case of
Button
, the order of signals is expected: first the field value is changed, then the button is pressed.In the case of
Tree
andItemList
, the signal order is reversed, which is inconvenient and leads to bugs in applying changes to the current item instead of the previous one (see below). You can use deferred signals as a workaround, but in my opinion this is a hack that could cause other bugs.See also:
Steps to reproduce
Change the value of the
SpinBox
field (without pressing Enter) and try clicking on theButton
, on theTree
item and on theItemList
item.Minimal reproduction project
focus_order_bug.zip
The text was updated successfully, but these errors were encountered: