Access to QLibrary pointers

Phil Thompson phil at riverbankcomputing.com
Wed Aug 30 22:06:43 BST 2023


On 30/08/2023 20:50, Maurizio Berti wrote:
> Some time ago I posted on StackOverflow (
> https://stackoverflow.com/a/60895316/2001654 ) a "hacky" way to use the
> qt_blurImage function that is internally used by Qt for graphics 
> effects
> and other things.
> 
> It basically uses ctypes to access the function in the QtWidgets 
> library,
> the implementation is a bit sketchy, but it works.
> 
> While checking it again, as a user had problems accessing the function 
> in
> Qt6, I stumbled upon the QLibrary class, and I was wondering if I could 
> use
> it instead.
> 
> Unfortunately, while the library loads and resolve() properly gets 
> access
> to the function, it returns a voidptr which obviously is not callable.
> 
> I have limited experience with SIP (I only used it on very few 
> occasions
> and with simple castings), so maybe the solution is quite simple, but I
> really don't know how to make that pointer to a callable function - or 
> even
> if it's possible.
> 
> Also, I assume that the arguments would still be ctypes, right? If 
> that's
> the case, there would be no real benefit in using QLibrary, I suppose.
> 
> Still, it would be interesting to know if it could be used and how.

There is no support for calling a voidptr. You can convert it to an 
integer which may be used by something else.

Phil


More information about the PyQt mailing list