Details
-
Suggestion
-
Resolution: Fixed
-
P4: Low
-
None
-
6.x
-
None
Description
QTableView.setAlternatingRowColors, QTableView.setShowGrid, QTableView.setSortingEnabled, QTableView.setWordWrap, QHeaderView.setCascadingSectionResizes, QHeaderView.setStretchLastSection, QHeaderView.setVisible, are just some examples of the various setters the PySide object expose.
In their type hints, you can see (for example)
def setVisible(self, v: bool) -> None: ...
but if you try to invoke the methods by keword (as for example suggested by some linters, like https://docs.astral.sh/ruff/rules/boolean-positional-value-in-call/ ) there are runtime errors, like
TypeError: QHeaderView.setVisible() takes no keyword arguments
you could mark the various methods to accept positional only parameters, just adding a ,/ after the boolean parameter
ref: pep 570