advertisement

Print
Boudewijn and Cameron Argue for Qt

by Cameron Laird and Boudewijn Rempt
07/07/2000

Related Articles

Qt Attracting Interest Among Application Developers

Visual Design With Qt

Editor's note -- Seldom do I run across an article on application development that is just plain fun. I have one here. There are four characters in this story talking about the Qt authoring environment: Cameron Laird, Boudewijn Rempt, Thomas, and Paul. Cameron and Boudewijn are real life developers. Thomas and Paul are composite characters that represent real views. The discussion among them is lively and informative.

Last Wednesday Thomas, a fellow hacker, came by for a visit. He's heard our praise of the Python language and Qt graphical user interface (GUI) toolkit. Thomas, though, is a doubter, one who needs to see for himself. He arrived with a demand to be shown "what all the fuss is about." So we did:

Thomas: Well, I'm a Windows developer mainly. That's where the money is, isn't it? Why should I use a cross-platform GUI toolkit when there's a perfectly good native one, and that's MFC (Microsoft Foundation Classes).

Boudewijn: True, you are a Windows developer ... for now -- you won't be one for ever. Even Nathan Myhrvold, chief technologist at Microsoft until last year, thinks that Windows will have been replaced by another system in five years time. You might want to grab the opportunity to have your app running everywhere.

Cameron: That's not all. Even though MFC is native, we think we make better Windows applications with Qt than if we were using MFC. Frankly, it looks to me as though Microsoft is coming to a similar conclusion; they appear to be de-emphasizing MFC, and certainly not investing more in it. Qt's design is a strong one. Signals and slots (the "callback" mechanism in Qt) make for safer programming than MFC's hooks. Qt is savvy about Unicode from the ground up; internationalization simply works the way it should.

Boudewijn: It's hard to show you a side-by-side comparison of Qt and MFC, because MFC is so thin a layer on the C foundations of Windows - Qt is C++ from the ground up. In contrast with MFC, it's very easy to create a reusable component that can work as well as a document view as in a dialog window:

class complicatedWidget(QWidget):
  def __init__(self, *args):
    ...

class aDialog(QDialog):
  def __init__(self, *args):
    self.layout=QGridLayout(self, 1, 1)
    self.widget=complicatedWidget(self, "dialog view")
    self.layout.addWidget(self.widget, 0, 0)
    ...

class aWindow(QMainWindow):
  def __init__(self, *args):
    self.view=complicatedWidget(self, "main view")
    self.setCaption("Main Window")
    self.setCentralWidget(self.view)
    ...

The only difference is that a main window has a built-in layout manager.

Pages: 1, 2, 3

Next Pagearrow