Properly relinquish activeFocus on ValueInput when editing is finished#255
Merged
Merged
Conversation
There is no use case for a ValueInput that will be fed into a setting to be multi-line in nature
This gives the focus back to the parent setting, relinquishing focus on the ValueInput and moving it out of the edit state.
This was referenced Feb 11, 2023
johnny9
approved these changes
Feb 16, 2023
johnny9
pushed a commit
to johnny9/bitcoin-core-app
that referenced
this pull request
Jul 4, 2025
…lueInput when editing is finished c10442c qml: Give up focus on ValueInput when editing finished (jarolrod) daeca18 qml: Make ValueInput a TextInput instead of a TextEdit (jarolrod) Pull request description: On master, pressing `enter` while editing a setting that has a ValueInput does not properly relinquish focus from the ValueInput, still leaving it in an editing state. This fixes that by: a. Making ValueInput a [TextInput](https://doc.qt.io/qt-5/qml-qtquick-textinput.html#text-prop) instead of a [TextEdit](https://doc.qt.io/qt-5/qml-qtquick-textedit.html) - TextEdit allows for multi-line input, so an `enter` in this would add a new line, which we don't want. There is no use case for a ValueInput to be multiple lines, it should only be one. Additionally, this prevents `enter` from signaling that editing is finished - TextInput is specifically for single line input. This QML type also allows us to do necessary validations with a [validator](https://doc.qt.io/qt-5/qml-qtquick-textinput.html#validator-prop), [inputMask](https://doc.qt.io/qt-5/qml-qtquick-textinput.html#inputMask-prop), and signal what kind of keyboard we want with [inputMethodHints](https://doc.qt.io/qt-5/qml-qtquick-textinput.html#inputMethodHints-prop). Additionally, this allows for `enter` to signal that editing is finished. b. Relinquishing focus on the ValueInput itself, by forcing focus back to the parent Setting. [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/insecure_win_gui.zip?branch=pull/255) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/insecure_mac_gui.zip?branch=pull/255) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/insecure_mac_arm64_gui.zip?branch=pull/255) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/android/insecure_android_apk.zip?branch=pull/255) ACKs for top commit: johnny9: ACK c10442c Tree-SHA512: 6b2d40b9f715b05b239112835eb9078ce5637005bbea28888161179ac8ea9f736471b8e734542a90538e1bfca0c0c41de426954d311852534859cf51431d755f
tx-signer450
added a commit
to tx-signer450/gui-qml
that referenced
this pull request
Oct 20, 2025
…lueInput when editing is finished c10442cdfa31d8fe33a45155fa78a7bd760ebb75 qml: Give up focus on ValueInput when editing finished (jarolrod) daeca18101bd58289897414116d192d6ce5d92f5 qml: Make ValueInput a TextInput instead of a TextEdit (jarolrod) Pull request description: On master, pressing `enter` while editing a setting that has a ValueInput does not properly relinquish focus from the ValueInput, still leaving it in an editing state. This fixes that by: a. Making ValueInput a [TextInput](https://doc.qt.io/qt-5/qml-qtquick-textinput.html#text-prop) instead of a [TextEdit](https://doc.qt.io/qt-5/qml-qtquick-textedit.html) - TextEdit allows for multi-line input, so an `enter` in this would add a new line, which we don't want. There is no use case for a ValueInput to be multiple lines, it should only be one. Additionally, this prevents `enter` from signaling that editing is finished - TextInput is specifically for single line input. This QML type also allows us to do necessary validations with a [validator](https://doc.qt.io/qt-5/qml-qtquick-textinput.html#validator-prop), [inputMask](https://doc.qt.io/qt-5/qml-qtquick-textinput.html#inputMask-prop), and signal what kind of keyboard we want with [inputMethodHints](https://doc.qt.io/qt-5/qml-qtquick-textinput.html#inputMethodHints-prop). Additionally, this allows for `enter` to signal that editing is finished. b. Relinquishing focus on the ValueInput itself, by forcing focus back to the parent Setting. [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/insecure_win_gui.zip?branch=pull/255) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/insecure_mac_gui.zip?branch=pull/255) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/insecure_mac_arm64_gui.zip?branch=pull/255) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/android/insecure_android_apk.zip?branch=pull/255) ACKs for top commit: johnny9: ACK c10442cdfa31d8fe33a45155fa78a7bd760ebb75 Tree-SHA512: 6b2d40b9f715b05b239112835eb9078ce5637005bbea28888161179ac8ea9f736471b8e734542a90538e1bfca0c0c41de426954d311852534859cf51431d755f
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On master, pressing
enterwhile editing a setting that has a ValueInput does not properly relinquish focus from the ValueInput, still leaving it in an editing state. This fixes that by:a. Making ValueInput a TextInput instead of a TextEdit
enterin this would add a new line, which we don't want. There is no use case for a ValueInput to be multiple lines, it should only be one. Additionally, this preventsenterfrom signaling that editing is finishedenterto signal that editing is finished.b. Relinquishing focus on the ValueInput itself, by forcing focus back to the parent Setting.