-
Notifications
You must be signed in to change notification settings - Fork 38.7k
qt: Set C locale for amountWidget #14177
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
Conversation
luke-jr
left a comment
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.
Not sure if this is a good idea. What is the practical effect of setting the locale here?
Can a correct/point-based number still be entered and work properly?
src/qt/transactionview.h
Outdated
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.
This isn't used anywhere. Probably we either need to delete it in cleanup, or don't need to store it at all.
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.
@luke-jr QDoubleValidator uses system locale if its own one is not set. If system decimal separator is , then QDoubleValidator will not accept . at all. I've used the same approach as BitcoinAmountField class does:
bitcoin/src/qt/bitcoinamountfield.cpp
Line 198 in af4fa72
| amount->setLocale(QLocale::c()); |
amountValidator member is declared in the same place where amountWidget is.
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.
it is used: it's used to validate what is entered in the amount field
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.
Oh I agree with @luke-jr actually; there's no need to store this in the object, just store it temporarily in a local variable in TransactionView::TransactionView while you need to manipulate it.
|
we don't use the system locale for bitcoin amount entry, so this seems right utACK bd5107055d393e14269faca84741c8167500e7b5 |
src/qt/transactionview.cpp
Outdated
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.
e.g. do
QDoubleValidator *amountValidator = new QDoubleValidator(0, 1e20, 8, this);bd51070 to
9531814
Compare
|
I just found out that there is another PR addressed this issue: #13278 |
|
@hebasto The bot can't check against PRs that conflict with master. |
|
Unsure. |
9531814 to
b0510d7
Compare
|
@jonasschnelli
The comma
Fixed. Please re-review. |
|
On a macOS machine with Dutch locale ( When I enter a comma in the search screen it's ignored, as @jonasschnelli noticed. That's annoying, but at least it fixes the bug. The user will see a list of amounts with tACK b0510d7 |
Summary: b0510d78aedde864756199fe71ca98f8e95dd44f Set C locale for amountWidget (Hennadii Stepanov) Pull request description: Fix #13873 --- Backport of Core [[bitcoin/bitcoin#14177 | PR14177]] Test Plan: ninja all ./qt/bitcoin-qt -testnet move to transactions tab, try set an amount filter using comma instead of point and make sure I fail to do so. Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D8545
b0510d7 Set C locale for amountWidget (Hennadii Stepanov) Pull request description: Fix bitcoin#13873 Tree-SHA512: ef26b35ef83c3a87ebd90650f6d833b00a24f6c114b68fe01acd4a14d1f5bdec066f438eb7781c1e55c32640838c54e00b8f082c390639ade8d9a58830833d4a
Fix #13873