Commit 63d75410 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

BC: Edit: Fix sort command and scale column.

Showing with 6 additions and 1 deletion
+6 -1
...@@ -50,6 +50,9 @@ class TableModel(QAbstractTableModel): ...@@ -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): ...@@ -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 ( ...@@ -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): ...@@ -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):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment