mirror of https://gitlab.com/pamhyr/pamhyr2
BC: Edit: Fix sort command and scale column.
parent
2f0b5b2e31
commit
63d7541062
|
|
@ -50,6 +50,9 @@ class TableModel(QAbstractTableModel):
|
||||||
return len(self._headers)
|
return len(self._headers)
|
||||||
|
|
||||||
def data(self, index, role):
|
def data(self, index, role):
|
||||||
|
if role == Qt.TextAlignmentRole:
|
||||||
|
return Qt.AlignHCenter | Qt.AlignVCenter
|
||||||
|
|
||||||
if role != Qt.ItemDataRole.DisplayRole:
|
if role != Qt.ItemDataRole.DisplayRole:
|
||||||
return QVariant()
|
return QVariant()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ class SortCommand(QUndoCommand):
|
||||||
def redo(self):
|
def redo(self):
|
||||||
self._data.sort(
|
self._data.sort(
|
||||||
_reverse=self._reverse,
|
_reverse=self._reverse,
|
||||||
key=lambda x: x.name
|
key=lambda x: x[0]
|
||||||
)
|
)
|
||||||
if self._indexes is None:
|
if self._indexes is None:
|
||||||
self._indexes = list(
|
self._indexes = list(
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ from PyQt5.QtWidgets import (
|
||||||
QDialogButtonBox, QPushButton, QLineEdit,
|
QDialogButtonBox, QPushButton, QLineEdit,
|
||||||
QFileDialog, QTableView, QAbstractItemView,
|
QFileDialog, QTableView, QAbstractItemView,
|
||||||
QUndoStack, QShortcut, QAction, QItemDelegate,
|
QUndoStack, QShortcut, QAction, QItemDelegate,
|
||||||
|
QHeaderView,
|
||||||
)
|
)
|
||||||
|
|
||||||
from View.Plot.MplCanvas import MplCanvas
|
from View.Plot.MplCanvas import MplCanvas
|
||||||
|
|
@ -69,6 +70,7 @@ class EditBoundaryConditionWindow(ASubMainWindow, ListedSubWindow):
|
||||||
)
|
)
|
||||||
table.setModel(self._table)
|
table.setModel(self._table)
|
||||||
table.setSelectionBehavior(QAbstractItemView.SelectRows)
|
table.setSelectionBehavior(QAbstractItemView.SelectRows)
|
||||||
|
table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
|
||||||
table.setAlternatingRowColors(True)
|
table.setAlternatingRowColors(True)
|
||||||
|
|
||||||
def setup_plot(self):
|
def setup_plot(self):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue