mirror of
https://github.com/shizand/statapp.git
synced 2024-12-23 12:12:59 +03:00
parent
240a517dd6
commit
30447a801a
@ -19,8 +19,8 @@
|
||||
#
|
||||
import numpy as np
|
||||
from PySide2 import QtCore
|
||||
from PySide2.QtCore import Slot
|
||||
from PySide2.QtWidgets import QMainWindow, QMessageBox
|
||||
from PySide2.QtCore import Slot, Qt, QPoint
|
||||
from PySide2.QtWidgets import QMainWindow, QMessageBox, QAction, QMenu
|
||||
|
||||
from statapp.calculations import generateXValues, generateYValues
|
||||
from statapp.constants import NUMBERS_PRECISION
|
||||
@ -79,6 +79,27 @@ class MainWindow(QMainWindow):
|
||||
# x1 = generateXValues(20, 2, 0, y)
|
||||
# x2 = generateXValues(10, 1, 0, y)
|
||||
# self.model.updateAllData(np.concatenate([y, x1, x2], axis=1))
|
||||
self.ui.tableView.horizontalHeader().setContextMenuPolicy(Qt.CustomContextMenu)
|
||||
self.ui.tableView.horizontalHeader().customContextMenuRequested.connect(self.removeColumn)
|
||||
|
||||
|
||||
def removeColumn(self, event: QPoint):
|
||||
menu = QMenu(self)
|
||||
|
||||
col = self.ui.tableView.columnAt(event.x())
|
||||
|
||||
if col == 0:
|
||||
return
|
||||
|
||||
def fun():
|
||||
self.model.removeCol(col)
|
||||
self.isDataChanged = True
|
||||
|
||||
selectAction = QAction("Удалить", self)
|
||||
selectAction.triggered.connect(fun)
|
||||
menu.addAction(selectAction)
|
||||
menu.exec_(self.ui.tableView.mapToGlobal(event))
|
||||
|
||||
|
||||
|
||||
def updateActionsEnabled(self):
|
||||
|
@ -33,3 +33,6 @@ class InputValuesModel(EditableTableModel):
|
||||
|
||||
def getY(self):
|
||||
return self._data[:, 0]
|
||||
|
||||
def removeCol(self, index: int):
|
||||
self.updateAllData(np.delete(self._data, index, axis=1))
|
||||
|
Loading…
Reference in New Issue
Block a user