I think I found the culprit!
I have some custom delegates on most of my models to accept both comma and dot decimal separated numbers and cohere both to dot notation.
If I remove these delegates from the QTableView the problem disappears.
It does not solve the layout problem on the left though...
As a reference this is the code for one of the delegates:
class NumberFormatDelegate(QItemDelegate):
def __init__(
self,
parent=None,
bottom: float = -float("inf"),
top: float = float("inf"),
decimals: int = -1,
) -> None:
super().__init__(parent)
self.bottom = bottom
self.top = top
self.decimals = decimals
def createEditor(self, parent, option, index):
editor = LineSpinBox(
parent,
bottom=self.bottom,
top=self.top,
decimals=self.decimals,
)
return editor
def setEditorData(self, editor, index):
data = index.data(Qt.DisplayRole)
editor.setText(data)
def setModelData(self, editor, model, index):
model.setData(index, editor.text(), Qt.EditRole)
LineSpinBox is just a subclass of a LineEdit with some validation on top.