fix: 负值错误

This commit is contained in:
iridiumR 2023-06-04 14:26:07 +08:00
parent 0c67dbe66b
commit de7bd7f8f2
No known key found for this signature in database
GPG key ID: 49735733EB1A32C8
2 changed files with 8 additions and 4 deletions

View file

@ -1,2 +0,0 @@
from PyQt6.QtWidgets import *
from PyQt6.QtCore import *

View file

@ -139,8 +139,14 @@ class TransTab(TabPage):
amountLabel = QLabel("Amount:") amountLabel = QLabel("Amount:")
amountLine = QLineEdit() amountLine = QLineEdit()
num = self.transData[self.rows[0].row()][5] num = self.transData[self.rows[0].row()][5]
# 去掉¥符号 # 去掉¥符号,考虑负值
num = num[1:] if num[0] == '-':
num = num[2:]
num = '-' + num
else:
num = num[1:]
amountLine.setText(num) amountLine.setText(num)
# 只允许输入两位小数 # 只允许输入两位小数
amountLine.setValidator(QDoubleValidator(0.00, 999999999.99, 2)) amountLine.setValidator(QDoubleValidator(0.00, 999999999.99, 2))