我想对齐模型中的所有行。我在“QtDesigner”中将 .ui 编译为 .py 并创建 form.py。Ui_MainWindow 来自 form.py 。你能用例子解释解决办法吗?
回复:我想对齐模型中的所有行。我在“QtDesigner”中将 .ui 编译为 .py 并创建 form.py。Ui_MainWindow 来自 form.py 。你能用例子解释解决办法吗?
class App(Ui_MainWindow):
def __init__(self, window):
self.setupUi(window)
# code...
numbers = [["Thomas","17776661122",❌],["Parker","1777666331",❌],["Michael","17775553322",❌]]
CreateTable()
def CreateTable(self,fromlist):
for i in range(0,len(fromlist)):
self.model.addCustomer(Customer(fromlist[i][0],fromlist[i][1],fromlist[i][2]))
### align code
# code...
这是我的 QtTableView 模型。
class Customer(object):
def __init__(self,name,number,status):
self.name = name
self.number = number
self.status = status
class CustomerTableModel(QtCore.QAbstractTableModel):
ROW_BATCH_COUNT = 15
def __init__(self):
super(CustomerTableModel,self).__init__()
self.headers = [' İsim ',' Telefon No (Örn 9053xx..) ',' Mesaj Durumu ']
self.customers = []
self.rowsLoaded = CustomerTableModel.ROW_BATCH_COUNT
def rowCount(self,index=QtCore.QModelIndex()):
if not self.customers:
return 0
if len(self.customers) <= self.rowsLoaded:
return len(self.customers)
else:
return self.rowsLoaded
def canFetchMore(self,index=QtCore.QModelIndex()):
if len(self.customers) > self.rowsLoaded:
return True
else:
return False
一只斗牛犬
茅侃侃
相关分类