[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Advices on embedding python in Qt/C++ application
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2019-09-03 16:33:09
Message-ID: 236904c945793c60930fc4d429b91c46 () riverbankcomputing ! com
[Download RAW message or body]

On 03/09/2019 17:23, Alexis Barbot wrote:
> Thanks Phil,
> 
> I recompiled PyQt5.13 against Qt5.12 mingw32. I had to modify the qmake
> generated .pro to add "QMAKE_CXXFLAGE += "-D_hypot=hypot", and add
> "-lpython" to "LIBS" to every sub project, but it finally compiled. Now 
> I'm
> trying to run an exemple as you said, but it crashes without 
> explainations.
> Here is the code sample:
> 
> #include <sip.h>
> #include <Python.h>
> #include <QDateTime>
> 
> ...
> 
> Py_Initialize();
> PyImport_ImportModule("sip");

You don't need this line ^^^^

> auto sipAPI_QtCore = reinterpret_cast<const
> sipAPIDef*>(PyCapsule_Import("PyQt5.sip._C_API", 0));
> PyImport_ImportModule("PyQt5.QtCore");
> auto type = sipAPI_QtCore->api_find_type("QDateTime");
> 
> Could someone confirm me this example should work, please?

You should have error checking on each of the last 3 lines. If they are 
working then debug it using whatever tools mingw provides.

Phil
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic