[PyQt] Porting qt3 .ui files to qt4

David Boddie david at boddie.org.uk
Tue Aug 14 14:26:48 BST 2007


On Tue Aug 14 13:40:18 BST 2007, Jeremy Moskovich wrote:

>     I'm trying to port a fairly large application built with qt3 and 
> PyQT to PyQT under qt4.
> 
>     Does anyone have any tips on how to port over the .ui files?  qt4's 
> designer happily imports them, although it converts some of the widgets 
> to qt3support widgets which PyQT doesn't appear to wrap.

That's right. There was a third-party project to wrap some of these, but it's
probably not the right thing to spend too much time on if you want to port to
PyQt4.

>     Apart from rebuilding the .ui files from scratch, is there any 
> automated method (or shortcut) to move all widgets to equivalent qt4 
> widgets?  Are there any other strategies that maybe helpful in cases 
> such as this one?

The "Porting .ui Files to Qt 4" document covers one approach for C++:

  http://doc.trolltech.com/4.3/porting4-designer.html

Really, only the second method described in the "Working with uic3" section
is going to be useful; i.e. doing something like this:

  uic3 -convert myform3.ui > myform4.ui

It might be useful to look at the Qt3Support widgets that remain in the .ui
file after conversion and to cross-reference a list of them with the "Porting
to Qt 4" document:

  http://doc.trolltech.com/4.3/porting4.html

In some cases, you might be able to simply replace instances of Qt3Support
classes in the XML with their QtGui counterparts, taking care to update any
property definitions you find.

If you get stuck, consider posting a list of the Qt3Support widgets you are
left with to this list and ask for further advice.

David


More information about the PyQt mailing list