Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
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.
-
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
-
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
-
Are you talking about the Q-Model series of classes? Aka like a Model View of a data table
-
@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?
-
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
-
@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.
-
It is no bother @bundito if you have an honest question it is only a bad question if you choose not to ask it -- 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
-
@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.
-
Well I can answer python issues and/or coding design questions as well so feel free to ask those as well.
As to Qt documentation that is why I gave that reference as it is my first stop for all things Qt and I have it up and open all the time I am working on my python-pyqt stuff because I reference it often and doing searches <Ctrl+F> on that page for things has turned up a gem for me every now and again also when actually referencing something located on that page I always open it in a new tab so that I do not lose my base page and that speeds things for me and may for you as well just food for thought