On Sat, 06 Jun 2009 02:56:55 +0200, Giovanni Bajo <[email protected]> wrote: > On Sat, 6 Jun 2009 01:19:39 +0200, David Boddie <[email protected]> > wrote: >> On Fri Jun 5 19:25:01 BST 2009, Giovanni Bajo wrote: >> >>> On 6/4/2009 10:18 PM, Phil Thompson wrote: >> >>> > It can't be wrapped because of the nature of the function pointer >>> > arguments - bad API design. >>> >>> Is it the same with Jambi? >> >> I think so - look here: >> >> > http://doc.trolltech.com/qtjambi-4.5.0_01/com/trolltech/qt/core/QSettings.html > > Given that there is no way to unregister a format, I think that there is a > way to wrap it for PyQt: just prepare a fixed number of clones of global > read/write functions, that retrieve Python's callable objects from a > fixed-size global array. Each time registerFormat() is used, save the read > and write function callables into the global arrays (incref'ing them > forever, and using an ever growing counter that says how many custom > formats have been registered); then, call the C++ version and pass it the > pointers to the correct couple of clones of the global read/write > functions.
How do you identify the correct couple of clones? There's no problem with wrapping function pointers in themselves. What's missing is that those functions should also take the QSettings::Format as an additional parameter. A good API will allow you to use a single callback in all situations which requires that the callback is passed something that allows it to identify the particular context. Phil _______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
