Qt 4.2 Technology Preview

We had a few days with an intense bug fixing session here in Oslo trying to get the Qt 4.2 Tech preview out of the door. It's now available since about an hour.

Lots of work has gone into adding new features. Just check out the 4.2 intro page. But apart from the larger features mentioned there, lots of work has also gone into less visible areas:

  • Up until 4.1 Qt was now creating native window handles when the QWidget was constructed. This has now been changed to creating the handles on demand, something that decrease application startup time and resource consumption.
  • Qt now contains a parser that can parse CSS syntax. Currently the parser gets used in two places: In the HTML import for QTextDocument/QTextEdit to parse <style> tags and external stylesheets correctly. The other usage is in the new setStyleSheet() method of QWidget. This is still a bit undocumented, but it allows you to style your widgets using a CSS like syntax. Try for example calling setStyleSheet on QApplication with the following sheet:

    QPushButton { color: white; background-color: red;
    border-width: 2px; border-style: outset; border-color: yellow;
    QPushButton:pressed { border-style: inset; }
    QMenu { background-color: #00cccc; selection-background: brown; }
  • Another feature that is not mentioned, is that we now have a QWidgetAction class that can be used to add QWidgets to menus. In contrary to the similar feature we had in Qt 3, this one does now also work on Mac OS X.
  • Another thing you can do with Qt 4.2 is to add application private fonts to a Qt application, by just specifying the path to a truetype font (or embedding it as a resource into your application).
  • There are lots of other things that are not mentioned in the 4.2 intro page that I won't mention here neither, but I'm sure you'll find them.

    As always we will be happy to get your feedback on the new features.

    Have fun playing with the Tech Preview :)

Blog Topics: