This commit is contained in:
zky2020 2023-06-04 14:31:01 +08:00
parent 98844b2f27
commit 377c9a1118

View file

@ -1,8 +1,9 @@
from PyQt6.QtWidgets import *
from ._tab import TabPage
from ._pg import PostgresTab
from PyQt6.QtGui import QDoubleValidator
import json
import datetime
class CategoryTab(TabPage):
def __init__(self, parent):
@ -213,3 +214,16 @@ class CategoryTab(TabPage):
except Exception as e:
print(e)
QMessageBox.critical(self, 'Error', str(e))
# self.pg.execute("SELECT c_id, meta ->> 'name' FROM category ORDER BY c_id")
# self.rows = self.pg.fetchall()
print(self.rows)
# 初始化表格
self.transTable.clear()
self.transTable.setRowCount(len(self.rows))
self.transTable.setColumnCount(5) # 时间 账户 类别 金额 描述
self.transTable.setHorizontalHeaderLabels(['Time', 'Account', 'Category', 'Amount', 'Description'])
# 设置自动调整列宽
self.transTable.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Stretch)