-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add editingTimeout signal to Qgs(Double)SpinBox #59787
Add editingTimeout signal to Qgs(Double)SpinBox #59787
Conversation
Emitted when either: 1. 2 seconds has elapsed since the last value change in the widget (eg last key press or scroll wheel event) 2. or, immediately after the widget has lost focus after its value was changed. This signal can be used to respond semi-instantly to changes in the spin box, without responding too quickly while the user in the middle of setting the value.
For motivation see #59398 (comment) |
🪟 Windows buildsDownload Windows builds of this PR for testing. 🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. |
Very! Very nice! Is it possible to change the timeout delay ? 2 sec can be quite long sometimes |
It would make sense to add a |
@nicogodet @uclaros do you think the timeout should be a qsettings value? Or set via API per widget? |
I'm in favor for an API method |
Maybe both? A default QSettings timeout which can be overriden per widget? |
I'd say API. This is more of a helper instead of manually creating the qtimers. |
I guess I'm just confused why we'd want different timeout behaviour across different widgets. Wont that be inconsistent and feel "odd" for users? |
@@ -3,8 +3,8 @@ | |||
QgsDoubleSpinBox.MaximumValue = QgsDoubleSpinBox.ClearValueMode.MaximumValue | |||
QgsDoubleSpinBox.CustomValue = QgsDoubleSpinBox.ClearValueMode.CustomValue | |||
try: | |||
QgsDoubleSpinBox.__attribute_docs__ = {'returnPressed': 'Emitted when the Return or Enter key is used in the line edit.\n\n.. versionadded:: 3.40\n', 'textEdited': 'Emitted when the the value has been manually edited via line edit.\n\n.. versionadded:: 3.40\n'} | |||
QgsDoubleSpinBox.__signal_arguments__ = {'textEdited': ['text: str']} | |||
QgsDoubleSpinBox.__attribute_docs__ = {'returnPressed': 'Emitted when the Return or Enter key is used in the line edit.\n\n.. versionadded:: 3.40\n', 'textEdited': 'Emitted when the the value has been manually edited via line edit.\n\n.. versionadded:: 3.40\n', 'editingTimeout': 'Emitted when either:\n\n1. 2 seconds has elapsed since the last value change in the widget (eg last key press or scroll wheel event)\n2. or, immediately after the widget has lost focus after its value was changed.\n\nThis signal can be used to respond semi-instantly to changes in the spin box, without responding too quickly\nwhile the user in the middle of setting the value.\n\n.. versionadded:: 3.42\n'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While at it, removing the duplicate "the"?
QgsDoubleSpinBox.__attribute_docs__ = {'returnPressed': 'Emitted when the Return or Enter key is used in the line edit.\n\n.. versionadded:: 3.40\n', 'textEdited': 'Emitted when the the value has been manually edited via line edit.\n\n.. versionadded:: 3.40\n', 'editingTimeout': 'Emitted when either:\n\n1. 2 seconds has elapsed since the last value change in the widget (eg last key press or scroll wheel event)\n2. or, immediately after the widget has lost focus after its value was changed.\n\nThis signal can be used to respond semi-instantly to changes in the spin box, without responding too quickly\nwhile the user in the middle of setting the value.\n\n.. versionadded:: 3.42\n'} | |
QgsDoubleSpinBox.__attribute_docs__ = {'returnPressed': 'Emitted when the Return or Enter key is used in the line edit.\n\n.. versionadded:: 3.40\n', 'textEdited': 'Emitted when the value has been manually edited via line edit.\n\n.. versionadded:: 3.40\n', 'editingTimeout': 'Emitted when either:\n\n1. 2 seconds has elapsed since the last value change in the widget (eg last key press or scroll wheel event)\n2. or, immediately after the widget has lost focus after its value was changed.\n\nThis signal can be used to respond semi-instantly to changes in the spin box, without responding too quickly\nwhile the user in the middle of setting the value.\n\n.. versionadded:: 3.42\n'} |
sorry for having only such basic suggestions...
@nyalldawson Thinking on what would be my use case:
I'm not a UX expert, just my thought |
I would not use this for the case of typing values like the #59398 case. I really think that the |
Ok, API added for setting the timeout interval now. I've also decreased the default timeout interval to 1 second. |
Emitted when either:
This signal can be used to respond semi-instantly to changes in the spin box, without responding too quickly
while the user in the middle of setting the value.