@@ -0,0 +1,1368 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0Aimport sys%0Afrom PyQt5.QtCore import Qt, QAbstractTableModel, QVariant%0Afrom PyQt5.QtWidgets import QApplication, QTableView%0A%0Aclass MyModel(QAbstractTableModel):%0A%0A    def __init__(self, parent=None):%0A        super().__init__(parent)%0A%0A    def rowCount(self, parent):%0A        return 3%0A%0A    def columnCount(self, parent):%0A        return 2%0A%0A    def data(self, index, role):%0A        if role == Qt.DisplayRole:%0A            return str(%5Bindex.row(), index.column()%5D)%0A        return None%0A%0A    def headerData(self, index, orientation, role):%0A        if role == Qt.DisplayRole:%0A            if orientation == Qt.Horizontal:%0A                return %22ROW %7B%7D%22.format(index)%0A            elif orientation == Qt.Vertical:%0A                return %22COLUMN %7B%7D%22.format(index)%0A        return None%0A%0Aif __name__ == '__main__':%0A    app = QApplication(sys.argv)%0A%0A    table_view = QTableView()%0A    my_model = MyModel()%0A    table_view.setModel(my_model)%0A    table_view.show()%0A%0A    # The mainloop of the application. The event handling starts from this point.%0A    # The exec_() method has an underscore. It is because the exec is a Python keyword. And thus, exec_() was used instead.%0A    exit_code = app.exec_()%0A%0A    # The sys.exit() method ensures a clean exit.%0A    # The environment will be informed, how the application ended.%0A    sys.exit(exit_code)%0A

Add a snippet.