Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
[GUI] Use QRegexValidator instead of the QDoubleValidator. #1124
Have received reports from linux users experiencing problems with the amount editable box, not being able to write large numbers with decimals (even when the QDoubleValidator decimal limit was set to 8..).
To solve it without over complicate the code, have changed the QDoubleValidator for a QRegexValidator.
random-zebra left a comment •
Mhm, have few points here.
2) Even though the first two are not visible (due to inline validation), this expression has some error:
A possible solution could be:
3) Switching to regular expression validation makes
4) More importantly, I think that the inline validation provided with
Let me explain this with an example.
There are plenty solutions for this problem.
If my memory does't fail me,
k good, can even modify the
The wallet has it implemented already ;) . It will highlight the invalid field when the user press the send button and paint the borders in red.
Currently cannot be tested on a wallet with staking addresses due to the segfault fixed in #1142. This needs to be rebased on latest master (possibly squashing the two commits).
Other than that, it almost fixes points 1-3.
Only one last edge case remains: you can enter
and the dot counts as one char.
Then, only point 4 remains.
which allows for numbers starting with more than one
To complete the flow, we should just prevent the move of the cursor to end of the line when modifying (which is done by
// set text without moving the cursor const int cpos = ui->lineEditAmount->cursorPosition(); ui->lineEditAmount->setText(amountStr); ui->lineEditAmount->setCursorPosition(cpos);
Lastly, the comma
QStringList parts = removeSpaces(value).replace(",", ".").split(".");
there, to treat both chars (comma and dot) as decimal separators now.
awesome review, pretty detailed
Just one point about the cursor.
The rest is great
8341d7e [GUI] Use QRegexValidator instead of the QDoubleValidator to validate QEditLine amounts. (furszy) Pull request description: Have received reports from linux users experiencing problems with the amount editable box, not being able to write large numbers with decimals (even when the QDoubleValidator decimal limit was set to 8..). Have checked it in macOS and everything is fine there, so.. the issue is pointing to an internal QT QDoubleValidator class problem that has nothing to do with our UI code in some linux distributions. To solve it without over complicate the code, have changed the QDoubleValidator for a QRegexValidator. Running fine in linux now too here, more eyes are welcome. ACKs for top commit: random-zebra: ACK 8341d7e Fuzzbawls: ACK 8341d7e Tree-SHA512: 908451fc8f2f8b4b23d0d00ba4199e2ba24367bfa509bffc4518d6f0d7b225067ce712a544fb94cbe2d7db2313256f82e7f809cf9ca076a724a2d1c42eba9c25
…ubleValidator. 8341d7e [GUI] Use QRegexValidator instead of the QDoubleValidator to validate QEditLine amounts. (furszy) Pull request description: Have received reports from linux users experiencing problems with the amount editable box, not being able to write large numbers with decimals (even when the QDoubleValidator decimal limit was set to 8..). Have checked it in macOS and everything is fine there, so.. the issue is pointing to an internal QT QDoubleValidator class problem that has nothing to do with our UI code in some linux distributions. To solve it without over complicate the code, have changed the QDoubleValidator for a QRegexValidator. Running fine in linux now too here, more eyes are welcome. ACKs for top commit: random-zebra: ACK 8341d7e Fuzzbawls: ACK 8341d7e Tree-SHA512: 908451fc8f2f8b4b23d0d00ba4199e2ba24367bfa509bffc4518d6f0d7b225067ce712a544fb94cbe2d7db2313256f82e7f809cf9ca076a724a2d1c42eba9c25
fa1987b [GUI] ColdStaking widget: fix "total staking" amount (random-zebra) 7ad5385 Update copyright headers (Fuzzbawls) 31433e2 [Docs] 4.0.0 release notes (Fuzzbawls) 8cfd8b5 [GUI] Border image workaround. (furszy) 82069c3 [Qt] Update translations from transifex (Fuzzbawls) 1894425 [GUI][Wallet] Allow spending of P2CS without coincontrol selection Github-Pull: #1193 Rebased-From: b8e4df8 (random-zebra) 102dfd5 [Consensus] Define MainNet changeover block for PIVX v4.0 Github-Pull: #1191 Rebased-From: 8f7dd00 (random-zebra) 9b9dc62 [GUI][BUG] Accept P2CS locked coins in coincontrol (random-zebra) 9d9909b [GUI] Use QRegexValidator instead of the QDoubleValidator to validate QEditLine amounts. (furszy) ed0a93a [GUI] Feature/Bug CoinControl Update on Open (Liquid369) 6009c24 [GUI] Validate wallet password on enter key press (warrows) 3caf895 [Network] Add SPORK 17 and 18 to the fMissingSporks flag + move the validation below the old protocol and the connected to ourself check. No need to send the message if we are going to end up disconnecting from the peer. (furszy) a7205ad [GUI] set focus when showing dialogs (random-zebra) 5f0d3e6 [GUI][Trivial] Make amount optional in staking address gen dialog Github-Pull: #1185 Rebased-From: a2d67d6 (random-zebra) 630e040 [GUI][Trivial] Fix tx detail dialog expanding policy Github-Pull: #1187 Rebased-From: 7e5253d (random-zebra) 96f240b [GUI][Trivial] move caps lock warning in askpassphrase dialog Github-Pull: #1186 Rebased-From: 5bd5bbc (random-zebra) 08ee144 [GUI][Bug] cold staking screen, fixing show receive addresses list in owner address editLine. (furszy) c71bc13 [GUI] Remove every pushButton focus property. (furszy) 01c95c6 [Doc] Remove stale image files (Fuzzbawls) 3cafa3a [Doc] Update gitian building docs (Fuzzbawls) 90d27bd [Utils] Update gitian-build.py for multi-os compatibility (Fuzzbawls) ddbceb4 Dead link to wrong PIVX website (NoobieDev12) c99d712 [Build] Add random-zebra gitian GPG public key fingerprint Github-Pull: #1180 Rebased-From: a88bff8 (random-zebra) 6cae0c9 [Trivial] fix minColdStakingAmount comment and type Github-Pull: #1174 Rebased-From: 35a5065 (random-zebra) a7f6d17 [GUI][Trivial] access Params() only from walletModel Github-Pull: #1174 Rebased-From: 4ad9492 (random-zebra) d41f9c6 [Cleanup] Remove extra calls to getDisplayUnit in ColdStakingWidget Github-Pull: #1174 Rebased-From: 5c3162b (random-zebra) 5c1a1a9 [GUI] Cold Staking Widget: set minColdStakingAmount from chain params Github-Pull: #1174 Rebased-From: 2369644 (random-zebra) c8e1762 [GUI] Removing cold staking "unconfirmed balance will not be shown" warning label. (furszy) 3a302aa [Wallet] GetAvailableP2CSCoins permitting unconfirmed tx. (furszy) 53901c0 [GUI] Cold staking, always update staking total amount (furszy) 9527147 [GUI][Bug] Cold staking screen, delegations list, total amount was not being updated. This solves the issue + re organize the UI form to present it aligned to the texts in the left. (furszy) c3d8f60 [Qt] properly copy IPv6 externalip MN info (Fuzzbawls) b1641f4 [Trivial] Clean time offset warning when it gets back within range Github-Pull: #1167 Rebased-From: c24d2b1 (random-zebra) c3ec18b [Qt] Periodic make translate (Fuzzbawls) 02b2a04 [GUI][Model] Do not request password when the wallet is unlocked to lock it for staking only (furszy) 3971d91 [GUI] Custom change address, editable box getting focus when the dialog is launched. (furszy) 6565097 [GUI] Masternodes wizard, IPv6 correctly stored between brackets. (furszy) 6cb9217 [GUI] tooltip css changes. (furszy) 4dff02c [GUI] Decreasing the tooltip padding for #1076 windows issue. (furszy) 0e2dd1d Rewording text under Change Wallet Passphrase Github-Pull: #1151 Rebased-From: 95bba7a (NoobieDev12) 38d3218 [GUI][Trivial] Rewording of Error message while trying to send with the transaction with wallet unlocked for staking only (NoobieDev12) 107a452 [Travis] Increase functional tests reserved time (Warrows) 7d94126 [Bug] Coded properly the URI from file read.. (furszy) 32a32f3 [GUI] Regtest corrections. (furszy) b4d5b57 [Bug] Fix segfault on GUI initialization for cold staker wallet (random-zebra) 33c7084 [GUI] Cold staking, alert user if the owner address is not from the wallet. (furszy) de5cf4a [Deployment] Windows taskbar icon pixelated. (furszy) 5dbb514 [GUI] Inform if open pivx conf and open backups folder failed due some OS incapacity/restriction. Plus minor cleanup over the touched files. (furszy) ffd7dce [Qt] Fix segfault when running GUI client with --help or -? (Fuzzbawls) 3d39ce6 Revert "[Params] TESTNET ONLY, do not merge in master." (Fuzzbawls) Pull request description: This updates the `4.0` branch with the PRs that have been merged since the branch-off point. Additionally, it reverts the locking to testnet (2e85666). List of included PRs: #1139 #1125 #1127 #1121 #1142 #1141 #1131 #1157 #1159 #1151 #1156 #1158 #1161 #1160 #1162 #1167 #1166 #1165 #1174 #1180 #1179 #1176 #1173 #1178 #1186 #1187 #1185 #1183 #1177 #1163 #1190 #1124 #1192 #1191 #1193 #1195 #1188 #1181 #1197 #1194 ACKs for top commit: Warrows: utACK fa1987b, diff looks good. random-zebra: utACK fa1987b and merging... Tree-SHA512: f65d04e5764fda9a9899276bb0de8d2b8b6e8152d471d32a8fccfd7f79acdd526d4f9b03d848f07c54defe0173448c01b573e39e26164281cfd05c66c9e9af5a