<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Philippines.<br>
<br>
I worked as a software engineer a couple of decades ago, moving
from assembly language to PL/M to C to C++ from embedded to MS-DOS to
Windows to MS-Visual Studio. I have done a little bit of programming
since then -- a few small work projects and some hobby stuff.<br>
<br>
Last year I started with Gentoo Linux and I have really enjoyed all
the learning that has involved in the switch from Windows. I still see
lots of room for improvement in the system, but on the other hand, the
range and quality of free(x2) software available is extremely
impressive. I love Firefox and I tolerate Thunderbird. I tolerate Gaim
but I do enjoy the Festival speech synthesis plug-in. I still don't
have anywhere the functionality on my Toshiba A70 laptop that Windows
gives (e.g., even "system restart" shuts down the OS but locks up
without rebooting) but I tolerate that (and might not buy a Toshiba
next time).<br>
<br>
I wanted to learn a little about programming in Linux so dabbled
with wxWindows/wxWidgets, Python and wxPython and Mono/C#, etc. (I keep
away from Java) but when I heard that QT4 was going to have an
OpenSource version I decided to go for that. Meanwhile, while I was
waiting, I went ahead and converted a small MFC program to QT3.<br>
<br>
I found that converting from MFC to QT involved two main issues:<br>
1/ Converting CString and a lot of container classes. (I was using
CString and CPtrArray<> etc. quite heavily.)<br>
2/ Converting the GUI/OS stuff.<br>
<br>
On the container classes, I decided to go to STL so that if I ever
converted to another class library, I wouldn't have to do all these
conversions again (as long as I stuck with C++). After using MFC, I
didn't find the STL calls intuitive (e.g. 'push_back' instead of
'append') but it seemed to be relatively straightforward even if
tedious.<br>
<br>
I converted CString to QString and there were a lot of changes like
length() went to size() if I remember correctly and there were
different philosophies on case so IsEmpty() went to isEmpty() etc. but
they were pretty straightforward to substitute. Many of the string
manipulation functions didn't have exact equivalents but it didn't take
too long to work out the QT way of doing it. It took me a while to work
around QString[] returning a QCharRef rather than a char but I finally
figured that out.<br>
<br>
The OS stuff such as file IO wasn't quite so straightforward but
not too bad either. QTAssistant was great and I had all of the class
information and sample code at my fingertips even when away from the
Internet. In fact, in terms of help, it was much better than the MFC
help system where many of my queries returned results about other MS
products that I wasn't using (even though I had the filter set to
C++/MFC).<br>
<br>
The GUI stuff was fun and signals and slots seemed very easy to
use. Some of the autolayout stuff was very different from the MFC
approach I had come from, but it was very quick to try out.<br>
<br>
All in all I really enjoyed learning QT3 and found it quite clean
and intuitive -- more so than MFC which always felt like a hack (which
it was). I found the debugging support in KDevelop/gdb not nearly as
good as I was used to in Visual Studio and I haven't figured out how to
use Valgrind yet.<br>
<br>
The shock came when QT4 came out and I converted to that. I had
read the advance notices so I was aware of some of the planned changes
in general terms. I decided not to try any automatic conversion tools
as this was a learning experience for me so like the conversion from
MFC, I was doing it all by hand. What stunned me is that the paradigm
for QT4 is quite different from QT3 in many ways.<br>
<br>
The container classes I had converted to STL so no problems/changes
there. QStrings changed quite a bit and I ended up completely removing
any leftover 'char's from my program (still leftover from MFC days) and
using QChar everywhere instead (also 'char*' to QString&). This was
quite a bit of work, but the benefit was that my code is much more
Unicode compliant so I have no complaints there. The QString class is
certainly very versatile. I get the impression that the Unicode and
localization/translation support in QT4 is excellent.<br>
<br>
The size() methods for most classes now return an int instead of a
uint so I went from int in MFC to uint in QT3 (which seemed more
logical to me) back to int in QT4.<br>
<br>
But a lot of the GUI stuff changed very dramatically. Some classes
disappeared completely, e.g., QHBox and QVBox. Ah yes, there's still
compatibility versions (called Q3HBox and Q3VBox but I wasn't messing
with compatibility stuff that will disappear again one day). And many
things changed in their philosophy, e.g., <br>
<br>
<pre> m_pHistoryBoxLabel = <b>new</b> QLabel( "&History", m_pMain, "HistoryBoxLabel" ); // if I've remembered it correctly
</pre>
became<br>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator" content="Kate, the KDE Advanced Text Editor">
<pre> m_pHistoryBoxLabel = <b>new</b> QLabel();
m_pHistoryBoxLabel->setText( <span
style="color: rgb(221, 0, 0);">"&History "</span>);
m_pMain->addWidget( m_pHistoryBoxLabel );
</pre>
and<br>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator" content="Kate, the KDE Advanced Text Editor">
<small><font color="#000000"> <span style="color: rgb(128, 128, 128);"><i>
m_pRepeatAction->addTo( m_pToolBar );</i></span></font></small><br>
became <br>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator" content="Kate, the KDE Advanced Text Editor">
<pre> m_pToolBar->addAction( m_pRepeatAction );
</pre>
so you can see that there's quite a bit of editing involved. In fact, I
found the conversion from QT3 to QT4 more frustrating than the
conversion from MFC to QT3. If I had realized that the changes were
going to be so wide reaching, I wouldn't have bothered making the
intermediate step to QT3.<br>
<br>
Some things are not working the way that it seemed they should. In
particular, my program crashes when working with toolbars and status
bar panes from the code. My code for that is all commented out for now.
I've found several places where the documentation is lacking, and one
or two where it is plain wrong. I guess that's what you get for using a
version x.0.0 and hopefully it'll be improved/fixed in V4.0.1 or
something.<br>
<br>
Some things I still haven't worked out how to do yet. For instance
QTextEdit had a signal clicked(int,int) that I conveniently used in QT3
but I can't find any way to get a signal if a QTextEdit is clicked on
in QT4. QT3 had a setPaletteBackgroundColor(QColor) for QWidget and QT4
has much more complex (but more powerful) painting controls but I
haven't figured them out yet so my application is back to black and
white for now.<br>
<br>
So basically I want to say DON'T UNDERESTIMATE THE WORK TO PORT
FROM QT3 to QT4, especially if you don't want to use the porting tool
and the compatibility layer (and I didn't try that as I said). The
changes are both major and widespread. I'm sure QT4 is cleaner and more
powerful, but that makes it very different to use from QT3!<br>
<br>
I'm sure QT4 is going to be a great product, and the open source
licensing on all supported platforms makes it a true contender now for
cross-platform open-source programming. But then I guess it'll take a
few QT update releases from TrollTech and then a few Linux releases
after that before QT4 libraries start becoming standard around the
place.<br>
<br>
It was an interesting learning experience. Maybe I'll have another
look at Mono next...<br>
<br>
Robert.<br>
<br>
<br>
</body>
</html>