The move from Qt3 to Qt4 started when I tried to build the 188.8.131.52 kernel on SLED 10, and I attempted to run 'make xconfig'. I'd already downloaded and built Qt 4.2.3 and I wanted to use it instead of Qt 3. I knew that Qt 4.2.2 was available to Ubuntu 7.04, and a version of Qt 4.2.1 is also available as part of Open Suse 10.2. With KDE 4 to be released sometime later this year and based on Qt4, I thought it might be a good idea to get a feel for how to port an application from Qt3 to Qt4. The astute reader will note that I performed this on Ubuntu, which is Gnome based. Why not just execute 'make gconfig' and use the Gnome-based configuration tool? To be different, I guess.
- As mentioned earlier, Ubuntu 7.04 repositories now have Qt 4.2.3.
- I installed and used KDBG to help debug some of the core dumps being produced while I was doing the migration.
- I pretty much followed the directions for porting from Qt3 to Qt4. My greatest challenge was modifying the Makefile in scripts/kconfig so that it would properly compile and link the binary qconf.
- A spanner thrown into the mix was the use of g++ 4.1.2. G++ would not compile some of the coding idioms in the Qt3 sources. Nothing major, but they needed to be cleaned up.
- The Trolltech porting tool qt3to4 did not catch everything that needed to be converted to use the Qt3 support packaged. Specifically it did not modify QAction to Q3Action. I had to discover this after qt3to4 had finished and I started to compile the modified sources.
- The number '0' (zero) is not a good value for an argument that is passed by reference. Specifically, 'Q3ListViewItem::setPixmap (int column, const QPixmap & pm)' core dumps when '0' is passed as the second argument under Qt4 and using the Qt3 support libraries. It works for plain old Qt3, simply because it's been in there since the beginning. I simply fixed the problem by adding 'QPixmap nullPixmap;' to the class definition, and passing nullPixmap as the second argument.
- As you can see from the screen shot, qconf has a strong Gnome look-and-feel. Qt4 is supposed to better integrate with Gnome, along with Java 6u1. From my experiences with Qt4 and Java 6u1 on this version of Ubuntu, I'd have to say that Trolltech and Sun are pretty close to realizing that goal. Development of graphical applications on Linux in general and Ubuntu in particular is growing richer and deeper at an ever accelerating rate.
One of the reasons I wanted to move to Qt4 is because I've got some ideas of my own about enhancing qconf. Before I do that I want to move completely to Qt4, removing all Qt3 support classes and libraries, making qconf a fully native Qt4 application.
The acid test came when I configured kernel 184.108.40.206 with my version of qconf, built it, and rebooted Ubuntu 7.04 Alpha 5+ with my kernel. It's not the first time I've tuned and built a kernel for this box. It is the first time I've used mkinitramfs instead of mkinitrd to create my initrd image. But everything built and worked and right now my Ubuntu system is running on top of the kernel I tweaked and built. It was a lot of fun and satisfying when it all worked.