As shown below:
import sys from PyQt5 import QtCore,QtGui from import QApplication, QMainWindow from import loadUi class MainWindow(QMainWindow): def __init__(self, parent=None): super(MainWindow, self).__init__(parent) loadUi('', self) () () def say(self): ("Ha ha ha.") print("Ha ha ha.") def showData(self): # Prepare the data model =() #Set the data header field name (0, ("Name")) (1, ("NO.")) # Setting up data entries (0, 0, ("Zhang San")) (0, 1, ("20120202")) (1, 0, ("Li Si.")) (1, 1, ("20120203000000000000000")) (2, 0, ("Li Si.")) (2, 1, ("20120203000000000000000")) (3, 0, ("Li Si.")) (3, 1, ("20120203000000000000000")) (4, 0, ("Li Si.")) (4, 1, ("20120203000000000000000")) (5, 0, ("Li Si.")) (5, 1, ("20120203000000000000000")) # Setting entry colors and fonts (0, 0).setForeground(((255, 0, 0))) (0, 0).setFont(("Times", 10, )) (3, 1).setBackground(((255, 255, 0))) # Sorted by number (1, ) # Bind the data model to a QTableView () #QTableView (0,100) (1,200) app = QApplication() w = MainWindow() () (())
Above this PyQT5 QTableView display bound data example details is all I have shared with you, I hope to give you a reference, and I hope you support me more.