HomePhabricator

qt: Improve BitcoinAmountField class

Description

qt: Improve BitcoinAmountField class

Summary:

This adds functions for specifing a min/max value for a BitcoinAmountField. These options only affect user input, so it's still possible to use setValue to set values outside of the min/max range. The existing value will not be changed when calling these functions even if it's out of range. The min/max range will be reinforced when the field loses focus.
This also adds SetAllowEmpty function which specifies if the field is allowed to be left empty by the user. If set to false the field will be set to the minimum allowed value if it's empty when focus is lost.

This is a backport of Core PR14608 [1/2]
Commit: https://github.com/bitcoin/bitcoin/pull/14608/commits/8711cc0c78fb15e49c6ab477a5d922fc51627873

Depends on D8177.

Test Plan:
ninja && src/qt/bitcoin-qt

Verify that in the spend tab you cannot set amount or fees larger than 21 MBCH or lower than 0.

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, Fabien

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8176

Details

Provenance
Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>Authored on Oct 29 2020, 18:31
PiRKCommitted on Oct 29 2020, 18:31
abc-botPushed on Oct 29 2020, 18:37
Reviewer
Restricted Owners Package
Differential Revision
D8176: qt: Improve BitcoinAmountField class
Parents
rABC3e66b6d59e84: Remove custom fee radio group
Branches
Unknown
Tags
Unknown