Looking for info on QML ListView engines/delegates from Python script
-
I did this all the time when I was an active KDE contributor (now semi-retired), but they have a bunch of custom classes to make some of these things easier.
I can't find anything about a data engine in Python connecting to a PySide2 list. Can anyone point me in the right direction? I'm much happier coding my interfaces in QML than regular widget code.
Thanks.
-
Hi,
Can you give more details about what you mean by data engine ?
-
@SGaist said in Looking for info on QML ListView engines/delegates from Python script:
Hi,
Can you give more details about what you mean by data engine ?
Essentially bit of code that iterates or creates a list of items and forwards them to the QML layout. Typically, you'd format them in QML as a ComboBox or a stack of Rectangles containing your items (probably with checkboxes). As the QML changed - box checked or ComboBox item selected - the QML would signal that back to the underlying script (i.e. main.py) to effect the change.
-
Here are the KDE API pages if they help you understand what I'm talking about. It's a sort of model/view concept.
https://api.kde.org/frameworks/plasma-framework/html/classPlasma_1_1DataSource.html
https://api.kde.org/frameworks/plasma-framework/html/classPlasma_1_1DataModel.html
-
@Denni-0 said in Looking for info on QML ListView engines/delegates from Python script:
Are you talking about the Q-Model series of classes? Aka like a Model View of a data table
Ah-hah. Yes. I was so accustomed to the helper classes KDE used that I couldn't recall the proper Qt name. So, thanks for jogging my failing memory.
Anyway... does PySide2/Qt4Py have support for these handy techniques?
-
@Denni-0 said in Looking for info on QML ListView engines/delegates from Python script:
Yeah Qt5 and its children PySide2 and PyQt5 all support the Model View concept if you go here https://doc.qt.io/qt-5/classes.html and do a search either on QAbstract or just Model you can see all of them
Thanks, @Denni-0. I appreciate your help (this is twice now), even if you're making me realize just how rusty I actually am.
I'll try not to bug you guys with every blank spot in my brain...
Thanks.
-
@Denni-0 said in Looking for info on QML ListView engines/delegates from Python script:
still yes if you could perhaps try to find the answer first ;) that might help you more than us feeding you fish every now and again
I couldn't agree more. I've been on enough forums in my years to know that rule. My problem here was that I couldn't recall the proper Qt name for this mechanism. And I think most people would agree that the entirety of the Qt documentation is quite a huge amount of information, and it's easy to get into a loop between related pages. :-)
Now I just have to solve a Python part of my project and I'll be making headway again.