Skip to content

Conversation

@hebasto
Copy link
Member

@hebasto hebasto commented Sep 9, 2018

Fix #13873

@fanquake fanquake added the GUI label Sep 9, 2018
Copy link
Member

@luke-jr luke-jr left a 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?

Copy link
Member

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.

Copy link
Member Author

@hebasto hebasto Sep 9, 2018

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:

amount->setLocale(QLocale::c());

amountValidator member is declared in the same place where amountWidget is.

Copy link
Member

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

Copy link
Member

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.

@laanwj
Copy link
Member

laanwj commented Sep 13, 2018

we don't use the system locale for bitcoin amount entry, so this seems right

utACK bd5107055d393e14269faca84741c8167500e7b5

Copy link
Member

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);

@hebasto
Copy link
Member Author

hebasto commented Sep 13, 2018

@luke-jr @laanwj
Thank you for your reviews.
Fixed.

@hebasto
Copy link
Member Author

hebasto commented Sep 23, 2018

I just found out that there is another PR addressed this issue: #13278
@MarcoFalke the @DrahtBot did not report about a PR conflict. Is it ok?

@maflcko
Copy link
Member

maflcko commented Sep 24, 2018

@hebasto The bot can't check against PRs that conflict with master.

@jonasschnelli
Copy link
Contributor

Unsure.
Current master won't let me enter a comma (,)... it forces me to use "." for the dec. separator.
While in this PR, I can enter a comma (gets ignored) which may confuse users.
Thoughts?

@hebasto
Copy link
Member Author

hebasto commented Sep 26, 2018

@jonasschnelli
Thank you for your review.

While in this PR, I can enter a comma (gets ignored) which may confuse users.

The comma , is a group separator in the C locale.

Thoughts?

Fixed. Please re-review.

@hebasto hebasto changed the title Qt: Set locale for amountWidget qt: Set C locale for amountWidget Sep 26, 2018
@Sjors
Copy link
Member

Sjors commented Oct 8, 2018

On a macOS machine with Dutch locale (, decimal separator) When I enter an amount with a comma in the Send screen it's automatically converted to a dot, which is nice.

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 . separators so they'll probably figure it out.

tACK b0510d7

@laanwj laanwj merged commit b0510d7 into bitcoin:master Oct 18, 2018
laanwj added a commit that referenced this pull request Oct 18, 2018
b0510d7 Set C locale for amountWidget (Hennadii Stepanov)

Pull request description:

  Fix #13873

Tree-SHA512: ef26b35ef83c3a87ebd90650f6d833b00a24f6c114b68fe01acd4a14d1f5bdec066f438eb7781c1e55c32640838c54e00b8f082c390639ade8d9a58830833d4a
@hebasto hebasto deleted the fix-amount-locale branch October 18, 2018 12:16
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Nov 28, 2020
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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 17, 2021
b0510d7 Set C locale for amountWidget (Hennadii Stepanov)

Pull request description:

  Fix bitcoin#13873

Tree-SHA512: ef26b35ef83c3a87ebd90650f6d833b00a24f6c114b68fe01acd4a14d1f5bdec066f438eb7781c1e55c32640838c54e00b8f082c390639ade8d9a58830833d4a
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GUI: Filtering by amount problem in tx list if decimal separator is not a point

7 participants