Chapter 4 Implementing Application Functionality
The central area of a QMainWindow can be occupied by any kind of widget. Here’s an overview of the possibilities:
- 1.Use a standard Qt Widget.
- 2.Use a custom widget.
- 3.Use a plain QWidget with a layout manager.
- 4.Use a splitter.
- 5.Use an MDI area.
QDataStream supports basic C++ types as well as many of Qt’s types. The syntax is modeled after the Standard C++ classes. For example,
out << x << y << z;
writes the variables x,y,and z to a stream,and
in >> x >> y >> z;
reads them from a stream. Because the C++ primitive integer types may have different sizes on different platforms, it is safest to cast these values to one of qint8, quint8, qint16, quint16, qint32, quint32,qint64, and quint64, which are guaranteed to be of the size they advertise (in bits).
QDataStream uses the most recent version of the binary format (version 9 in Qt 4.3), but it can be set to read older versions. To avoid any compatibility problems if the application is recompiled later using a newer Qt release, we explicitly tell QDataStream to use version 9 irrespective of the version of Qt we are compilingagainst. (QDataStream::Qt_4_3 is a convenience constant that equals 9.)