BC: Edit: Fix sort command and scale column.

mesh
Pierre-Antoine Rouby 2023-05-04 09:44:19 +02:00
parent 2f0b5b2e31
commit 63d7541062
3 changed files with 6 additions and 1 deletions

View File

@ -50,6 +50,9 @@ class TableModel(QAbstractTableModel):
return len(self._headers)
def data(self, index, role):
if role == Qt.TextAlignmentRole:
return Qt.AlignHCenter | Qt.AlignVCenter
if role != Qt.ItemDataRole.DisplayRole:
return QVariant()

View File

@ -80,7 +80,7 @@ class SortCommand(QUndoCommand):
def redo(self):
self._data.sort(
_reverse=self._reverse,
key=lambda x: x.name
key=lambda x: x[0]
)
if self._indexes is None:
self._indexes = list(

View File

@ -15,6 +15,7 @@ from PyQt5.QtWidgets import (
QDialogButtonBox, QPushButton, QLineEdit,
QFileDialog, QTableView, QAbstractItemView,
QUndoStack, QShortcut, QAction, QItemDelegate,
QHeaderView,
)
from View.Plot.MplCanvas import MplCanvas
@ -69,6 +70,7 @@ class EditBoundaryConditionWindow(ASubMainWindow, ListedSubWindow):
)
table.setModel(self._table)
table.setSelectionBehavior(QAbstractItemView.SelectRows)
table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
table.setAlternatingRowColors(True)
def setup_plot(self):