Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QTableView with `from __feature__ import snake_case, true_property`
petr.salajka last edited by
I'd like to use
from __feature__ import snake_case, true_propertydirective. I started with my small QTableView example code.
It's OK, but when I switch to
true_propertycase, it stops working.
As Qt for Python 6 released proposes, I simply replaced
view.model = modelbut then nothing happens and the view is empty. No error, just empty. I failed to find any docs for the
true_propertycase. Do you have any suggestions? Thanks.
eyllanesc last edited by eyllanesc
This feature is not documented (it would be good to report it as a bug) but in the post you indicate is for Qt properties:
With Qt 5.15.2, we introduced a new option called feature, enabling you to switch between camelCase and snake_case for most Qt APIs. With Qt 6.0, you can directly access Qt properties from your Python code, leaving aside the setters and getters, with the new true_property feature.
and the model is not a Qt Property so you must use the set_model method:
Hi and welcome to devnet,
QTableView has no "model" property hence you are replacing the setModel method with your model object. If anything you might be able to use "set_model" in place of setModel.