On Wed, 12 Aug 2009 10:16:30 +0200, Detlev Offenbach <[email protected]> wrote: > Hi, > > what would be the best method to convert a bigger application like eric4 to > > the new QString API? Is there a tool available doing a scan and > highlighting/converting incompatible API calls? Please give some hints.
Assuming you are doing it as part of a planned move to Python v3 (otherwise I can't see the point)... - Eliminate all calls to QString() and QStringList(). PyQt will always do the right thing when given a string or a list instead. - Deal with calling the very small number of Qt calls that make use of the mutability of QStrings. These are described in the PyQt documentation in the section covering the QString v2 API. Most are related to QValidator. - That leaves Qt calls that return QStrings and QStringLists where, for example, you might be calling toLower() on a result rather than lower(). There's not a lot that can be done to fix these apart from looking at the source and fixing exceptions as they arise. Mark Summerfield's advice to convert to Python types as early as possible and to convert to Qt types as late as possible (or always let PyQt do it for you) is very relevant. Generally there is a lot that can be done in terms of preparation before actually switching to the new API. In making sure the PyQt examples worked under both Python v2 and v3, once I'd followed Mark's advice there were relatively few cases where it actually mattered which QString API was enabled. Phil _______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
