thp / pyotherside

Python Bindings for Qt 5 and Qt 6. Allows you to access a CPython 3 interpreter directly from your Qt QML user interface code.
https://thp.io/2011/pyotherside/
Other
364 stars 49 forks source link

[RFC] No support for model implementations in Python #52

Open basak opened 8 years ago

basak commented 8 years ago

In C++, I can write an AbstractItemModel implementation. I'd like to do the same thing in Python so that I can have Pythonic data structures that can be manipulated naturally by a Python backend and the data reflected naturally with a QML frontend.

I have a basic implementation of this working. It needs considerable cleaning up and isn't ready yet, but I thought it would be useful to get some initial review and feedback on the basic design and API at this stage. I've pushed it to https://github.com/basak/pyotherside/tree/models. Some rudimentary documentation is at https://github.com/basak/pyotherside/blob/models/docs/models including an example, along with a basic model implementation in Python in https://github.com/basak/pyotherside/blob/models/docs/pymodel.py. Here are some notes copied from my initial documentation for your reference:

thp commented 8 years ago

If you turn it in to a pull request, I think it's easier to comment on the changes.

I think it's good to have that as another option, and if the performance is bad, we can always try to make it more efficient, or people just user other methods for interfacing QML with Python (I've done it in my projects by sending objects back and forth between QML and Python and manually syncing the QML state with the Python state). For a first version, I think it's okay to possibly trade performance for convenience (having the Python state sync automatically with QML is a nice thing to have).

thp commented 8 years ago

Can you turn this into a pull request?

thp commented 8 years ago

Any news there?

basak commented 8 years ago

Sorry, I've been busy. I do intend to finish this at some point, but I don't expect to get to it for a month or two at least.

basak commented 7 years ago

FYI, I've resumed this effort. I'll send a pull request soon, even if it's just my mess of work in progress so that you can comment inline. Probably best to get an idea of where you want things to go before I polish it up.

ernesst commented 6 years ago

Any update @basak on your commit ?