ChatCrawlersearch across public Telegram Open the app
Q

Qt for Python (PySide/Shiboken)

28 January 2020
2020-01-28×
28 January 2020
C
When Qt 6.0 is out, 5.15 will still have the patches on Gerrit, so if there are any issues you want to get fix, you will need to get the source for the latest 5.15 open soruce bug fix release, and then apply the patches. This is just stopping the release of further bug fixing releases. On your Open Source project, you have 3 options: 1. you stay with the latest open source 5.15.x 2. you cherry pick changes an generate your own 5.15.y thaty ou can use, 3. you move to qt6. I’m certain the technicallities of how the dev branch will work will be published soon.
Hi! I'm currently trying to compile the samplebinding example of PySide2, using Visual Studio 16 2019, however, I either get a .pyd and .dll that don't work (they can't be loaded in the main.py) or I can't compile with Visual Studio because it complains that the clang version is not > 8. Any suggestions?
shiboken build requires having libclang in path
and if you don’t build and use the internal wheels, you need to add libclang to the path
Check slides 19, 20 and 21
M
First I simply installed PySide2 through pip, which also installed shiboken2. However, to compile the binding example it appears shiboken2-generator is needed. So I went to https://download.qt.io/official_releases/QtForPython/shiboken2-generator/ and downloaded the matching wheel (5.13.2). I was then able to compile using the first method (with NMake), but the resulting dll and pyd "can't be found". So, I tried the other suggested way, using Visual Studio. I was able to create a solution. Loaded it, compiled it and got the error: "STL1000: Unexpected compiler version, expected Clang 8 or newer".
check the last two questions
you need to get shiboken2_generator
shiboken2 is just an util python module
C
nothing to do with the generation of Python bindings
M
Let me check that webinar, it seems to contain some useful info
the thing is, it’s impossible, at least for me to setup a mechanism for a wheel package (which is nothing else like a zip file) to discover where the libraries are
There will be a video available soon, the webinar happened last Thursday
M
It appears it can solve my problems, thanks! Also, I have another question. Is it possible in some way to access a wrapped c++ object from c++?
She explain how to setup shiboken too, and shows the two ways I mention on the slides
Does that work for you?
that’s covered in the scriptableapplication example
C
that ships a python interpreter, so you can modify the C++/Qt application frrom Python, having of course the option to modify it from c++ via slots and sutff
M
Maybe I can explain what I'm trying to do. I've been trying to find a solution for quite some time. I have a dll which is loaded by a software. The software knows the interface and so knows the methods to call. The interfaces, classes and methods are in a C++ library (not QT). I want to be able to bridge the dll to python and the cleanest way I found was through shiboken. Ideally, I would want to instantiate objects from the c++ library in python, but use them through the dll. I'm not sure if it's possible through shiboken, but maybe you have suggestions. Thanks.
C
I think the last bit is not possible, I mean creating bindings you will be able to create C++ object from Python, but you will be unable to modify them from C++.
C
Sorry, but I don’t have experience with that scenario, but I really feel it will not be possible. I might be wrong 😕
M
My initial idea was to bypass the function pointer and basically give the calling software an instance (created in python) through a pointer that can be obtained through getCppPointer
M
Unless I misunderstood the usage of getCppPointer
sigh, cannot remember, I think it was something with audio
where I improve the VoidPtr structure
M
Yes, by issue is audio related, specifically the VST protocol
maybe you saw them already?
C
it’s still open because my changes didn’t work completely
M
Did I understand getCppPointer correctly though?
C
I think your best bet at the moment, besides asking for feedback on the mailing list, is to grep inside the shiboken2/tests directory on the repo
M
I can pass the pointer to c++ and "use" it?
if then the C++ counterpart will ahve access to the modification
Python only works with copies
C
so getting the pointer will not affect the underlying C++ reference AFAIK
M
In theory I don't really need to modify, only to call methods
C
I truly recommend you to ask for feedback on the mailing list: bit.ly/pyside2 or the IRC channel #qt-pyside on the Freenode server
C
if you haven’t done contributions to Qt, this might be the first one, and believe me it will be really appreciatated if you do so
You will need to create a Qt account, and a Gerrit one, let me send you a link
once you have the accounts and clone the pyside-setup repository, I can let you know which file to modify to make the changes visible in the docs
C
need to go soon, but in any case I will leave you then the two options you have to add the code: * you can add just the code of the example inside the directory pyside-setup/examples you create three levels more with this name quick/customitems/painteditem/ and place the code there. * this one is more tricky, because you will need to adopt what is being presented here: https://codereview.qt-project.org/c/pyside/pyside-setup/+/285647 and do the same for your specific case. I recommend you the first one, so then we can try to modify the page easily afterwards
J
does I have to add the copyright at the beggining like other files ?
let me send you an example
there you can copy paste the one for the qml file and the python file
C
(change the copyright to 2020 also
Calendar: January 2020
MoTuWeThFrSaSu123456789101111213141510163117918192021192262322242252612772877291530231
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