changeset 68:597bf29c5898

Use a better validator (regexp) for the amount input field.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 09 Apr 2017 15:54:06 +0300
parents 7c507c1d30e9
children a242548ccce8
files main.cpp
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/main.cpp	Sun Apr 09 15:23:52 2017 +0300
+++ b/main.cpp	Sun Apr 09 15:54:06 2017 +0300
@@ -226,9 +226,13 @@
     ui->button_LogoImage->setPixmap(logoImage);
     ui->button_LogoImage->setAlignment(Qt::AlignCenter);
 
-    ui->edit_Amount->setValidator(new QDoubleValidator(0, 1000, 2, this));
     setCommonStyleSheet(this);
 
+    // Validator for amount input
+    //ui->edit_Amount->setValidator(new QDoubleValidator(0, 1000, 2, this));
+    QRegExp vregex("\\d{0,4}[,.]\\d{0,2}|\\d{0,4}");
+    ui->edit_Amount->setValidator(new QRegExpValidator(vregex, this));
+
     // Setup person list filtering and sorting
     peopleSortIndex = 1;
     peopleSortOrder = Qt::AscendingOrder;