[PyKDE] qsqlcursor lifetime for qdatatable

Jim Bublitz jbublitz at nwinternet.com
Wed Jun 26 00:56:00 BST 2002

On 25-Jun-02 Andreas Kloeckner wrote:
> i propose that we redefine the semantics of qdatatable in such
> a way that the table always takes posession of its cursor and
> frees it itself. (possible by means of setCursor with the
> autoDelete parameter) i would be willing to provide a patch
> for this, if there is any demand.

Just a comment (feel free to ignore it): If I understand this
correctly, you're suggesting changing the behavior of Qt under PyQt.
IMHO, this isn't a good idea, first because users should be able to
expect that PyQt works exactly like Qt (to the extent possible,
good or bad) and second, because someone will have to maintain the
patch (if integrated into PyQt) from now til doomsday. I'm not
saying it isn't possible to improve Qt or improve how Qt behaves
under Python - I'm more suggesting that you offer the 'patch' as a
stand-alone enhancement or add-on, perhaps as a set of subclasses or
something similar, but in a separate module.

As Python use increases, it becomes more likely that people will
distribute apps that are PyQt based, and they should be able to
expect a standard environment.
> i have one more question: how can you avoid the lengthy (~1.5
> h) complete recompile if you just make *one* change to *one*
> .sip file? "make" doesn't do the trick for me, it just does
> nothing.

You can try maintaining two separate PyQt hierarchies. The first is
where you compile PyQt, the second where you make modifications and
only run 'build.py' to generate C++ files, then copy only the
modified C++ files to the compile hierarchy. sip generates one file
pair per class, with filenames of the form:

<module name>/sip<module name><class name>.[cpp | h]

for example:

qt/sipqtQClass1.cpp, qt/sipqtQClass1.h

Depending on the modifications, you may also need to copy the new
qtcmodule.cpp, sipqtProxyqt.h, and sipqtDeclqt.h to the compile
directory (those are the filenames for the qt module - other
modules have similar files). For any module *other than* the qt
module, I'd just copy the entire modified subdirectory, since other
modules take very little time to compile compared to the qt module.
Running 'make' in the compile directory then will only re-compile
the new files and then link to the pre-existing object files.

If you add/delete classes, you have to edit the makefiles too
(unless you copy the entire module subdirectory), but
adding/deleting/modifying methods should work. Keep the /sip
directories in sync (or symlink them) in case you eventually do a
complete rebuild.


More information about the PyQt mailing list