The Central Widget

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.

    A standard widget like QTable or QTextEdit can be used as a central widget. In this case, the application's functionality, such as loading and saving files, must be implemented elsewhere (for example, in a QMainWindow subclass).

  2. Use a custom widget.

    Specialized applications often need to show data in a custom widget. For example, an icon editor program would have an IconEditor widget as its central widget. Chapter 5 explains how to write custom widgets in Qt.

  3. Use a plain QWidget with a layout manager.

    Sometimes the application's central area is occupied by many widgets. This can be done by using a QWidget as the parent of all the other widgets, and using layout managers to size and position the child widgets.

  4. Use a splitter.

    Another way of using multiple widgets together is to use a QSplitter. The QSplitter arranges its child widgets side by side like a QHBox, or in a column like a QVBox, with splitter handles to give some sizing control to the user. Splitters can contain all kinds of widgets, including other splitters.

  5. Use an MDI workspace.

    If the application uses MDI, the central area is occupied by a QWorkspace widget, and each of the MDI windows is a child of that widget.

Layouts, splitters, and MDI workspaces can be used in combination with standard Qt widgets or with custom widgets. Chapter 6 covers these classes in depth.

For the Spreadsheet application, a QTable subclass is used as the central widget. The QTable class already provides most of the spreadsheet capability we need, but it doesn't understand spreadsheet formulas like "=A1+A2+A3", and it doesn't support clipboard operations. We will implement this missing functionality in the Spreadsheet class, which inherits from QTable.

Part I: Basic Qt

Getting Started

Creating Dialogs

Creating Main Windows

Implementing Application Functionality

Creating Custom Widgets

Part II: Intermediate Qt

Layout Management

Event Processing

2D and 3D Graphics

Drag and Drop

Input/Output

Container Classes

Databases

Networking

XML

Internationalization

Providing Online Help

Multithreading

Platform-Specific Features



C++ GUI Programming with Qt 3
C++ GUI Programming with Qt 3
ISBN: 0131240722
EAN: 2147483647
Year: 2006
Pages: 140

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net