ChatCrawlersearch across public Telegram Open the app
Q

Qt for Python (PySide/Shiboken)

snapshot for September 2022
‹ September 2022 ›×
K
I haven't had a chance to play with it yet. Do you have a little sample app to work with?
M
Or you try the one one of the KDE Online?
After 5.15.2, the releases are Commercial LTS. Meaning that only people with a license can obtain the wheels. But, thanks to the KDE Free Qt Foundation agreement, before 12 months, the code of those commercial releases is available here https://download.qt.io/official_releases/QtForPython/shiboken2/ where you have the source code until 5.15.6, but you need to build it. Personally, I'd say forget about 5.15.x and try the latest from 6.x, even if there is a 5.15.x bug, it will be released in the next bug-fix release and be available to the public in about a year, so better to test 6.3.x hopefully and se if the bug is there.
C
I'd love to point you to some code but on weekend mode atm :P, but we do have support for the int* pointers. I'd recommend you look into the test/examples inside the shiboken source code, in case you looked int othe pyside-setup repo and nothing was there, then you could open a Suggestion to the bug tracking system with more code so other devs can check it out
S
Is there anyone that got PySide6/QML/Qt6/EGL to work on a RaspberryPi3 with the MediaPlayer and VideoOutput? At this moment I see a green screen, while gst-play is capable to play out over EGL.
F
Hi everyone, great to find this group! I came from PyQt5 and it's been amazing to get to know QML/PySide6 better. I have a question regarding good practices in structuring files when dealing with a qml application. For every new slot/signal connection related to a python class, should I create a new .py file and then call the setContextProperty directly from the main.py?
FranciscoHi everyone, great to find this group! I came from PyQt5 and it's been amazing to get to know QML/PySide6 better. I have a question regarding good practices in structuring files when dealing with a qml application. For every new slot/signal connection related to a python class, should I create a n
I recommend you not use setContextProperty, as it adds your Python classes to the QML global namespace. IIRC it was the first way to interface C++ classes with QML (at the time the API was created. Now you can access it in python). Better is to use more automatic registration available now. Any python classes you wish to expose to QML, annotate the class with @QmlElement https://doc.qt.io/qtforpython/PySide6/QtQml/QmlElement.html This will automatically register the class as a QML type. Then, in QML you can create an instance of the python class using MyPythonClass { id: foo } And use it like any other QML type.
K
I keep a single class I register with QML in it's own .py file, but that's probably just because that's standard practice when coming from C++. I'm not sure what the recommended approach is in the Python world.
Sorry if this is a silly question, but if I'm not setting the engine context, how can I expose a class that doesn't belong to the .py file that initially loaded the QML file?
F
This is how I've done it so far: if __name__ == "__main__": app = QApplication(sys.argv) engine = QQmlApplicationEngine() #Get Context main = MainWindow() myImageProvider = cam.ImageProvider() engine.rootContext().setContextProperty("backend", main) engine.rootContext().setContextProperty("myImageProvider", myImageProvider) engine.addImageProvider("myImageProvider", myImageProvider) #Load QML File qml_file = Path(__file__).resolve().parent / "qml/main.qml" engine.load(qml_file) if not engine.rootObjects(): sys.exit(-1) sys.exit(app.exec())
Is there any official documentation on how to install com.library.name?
I couldn't find it on QT documentation
K
FranciscoIs there any official documentation on how to install com.library.name?
Ah, that's just the namespace name you define for your Python registered classes. Name it whatever you want, provide a major version number (just '1' is fine. You'd only increase it if your module is used by other projects, and you want to maintain the old API along with the new one). Then in QML, to use it, you add an import line to make it accessible in your QML: import com.library.name 1.0
R
Can someone help me with a weird behaviour? As soon as I start my application (maximized) and open a section (a docked widget), the widget does not fit correctly on it, hiding the buttons at the bottom. But right after I move the window, it shows them correctly and stop hiding them when maximized.
R
id 29348742I cant see the problem
When the application starts, the widget does not fit correctly (button group is hidden). After resizing the window, it fits and shows the buttons. After that, no more troubles with components not being shown.
Calendar: September 2022
MoTuWeThFrSaSu12341567338191011121314215161171018193720921322232462512262728291302
Archive by month
Open in Telegram Каталог площадок Искать в ChatCrawler

A snapshot of an open public feed from the search index ChatCrawler — “Google for public Telegram”; refreshed as the venue is crawled. Times are UTC.

Public content only, official Telegram API. About · FAQ · What we do not do · Remove a page · Catalog