diff --git a/statapp/main_window.py b/statapp/main_window.py
index ec9ec0a..45dc63c 100644
--- a/statapp/main_window.py
+++ b/statapp/main_window.py
@@ -1,6 +1,6 @@
-from PySide6.QtCore import Slot
from PySide6.QtWidgets import QMainWindow
+from statapp.models.data_model import DataModel
from statapp.ui.ui_main_window import Ui_MainWindow
@@ -10,3 +10,5 @@ class MainWindow(QMainWindow):
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
+ self.model = DataModel()
+ self.ui.tableView.setModel(self.model)
diff --git a/statapp/models/data_model.py b/statapp/models/data_model.py
new file mode 100644
index 0000000..5101ba3
--- /dev/null
+++ b/statapp/models/data_model.py
@@ -0,0 +1,46 @@
+import numpy as np
+from PySide6 import QtCore
+from PySide6.QtCore import Qt
+
+
+class DataModel(QtCore.QAbstractTableModel):
+ def __init__(self, data=np.array([[1, 2, 3], [4, 5, 6]])):
+ super().__init__()
+
+ self._data = data
+
+ def rowCount(self, index):
+ return self._data.shape[0]
+
+ def columnCount(self, index):
+ return self._data.shape[1]
+
+ def headerData(self, section: int, orientation: Qt.Orientation, role: int = ...):
+ if role == Qt.DisplayRole:
+ if orientation == Qt.Orientation.Horizontal:
+
+ if section == 0:
+ return 'Y'
+
+ return f'X{section}'
+
+ return None
+
+ def flags(self, index):
+ return Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable
+
+ def setData(self, index, value, role):
+ if role == Qt.EditRole:
+ try:
+ value = int(value)
+ except ValueError:
+ return False
+ self._data[index.row(), index.column()] = value
+ return True
+ return False
+
+ def data(self, index, role):
+ if role == Qt.DisplayRole:
+ return int(self._data[index.row(), index.column()])
+
+ return None
diff --git a/statapp/ui/main_window.ui b/statapp/ui/main_window.ui
index f00abb1..526de21 100644
--- a/statapp/ui/main_window.ui
+++ b/statapp/ui/main_window.ui
@@ -26,7 +26,11 @@
-
-
+
+
+ false
+
+
@@ -36,7 +40,7 @@
0
0
800
- 22
+ 27