Widget Categories

Qt widgets can be categorized in a number of ways to make it easier to find classes you are likely to use. The more complex widgets may cross over into more than one category. This section provides a brief overview of some of the classes we are likely to use as we get started with GUI programming.

There are four categories of widgets. Button widgets, in "Windows style," are shown in Figure 11.2.

Figure 11.2. Button widgets, in "Windows style"

Input widgets, in "Plastique style," are shown in Figure 11.3.

Figure 11.3. Input widgets, in "Plastique style"

Display widgets are non-interactive widgets, such as QLabel, QProgressBar, and QPixMap.

Container widgets, such as the QMainWindow, QFrame, QToolBar, QTabWidget, and QStackedWidget, contain other widgets.

These widgets are used as building blocks to create other more complex widgets, such as:

  • Dialogs for asking the user questions or popping up information, such as the QFileDialog, QInputDialog, and QErrorMessage.
  • Views that provide displays of collections of data such as QListView, QTReeView, and QTableView.

In addition, there are some Qt classes that do not have any graphical representation (so they are not widgets) but are used in GUI development. They include

  • Qt Data types QPoint and QSize are popular types to use when working with graphical objects.
  • Controller classes QApplication and QAction are both objects that manage the GUI application's control flow.
  • Layouts These are objects that dynamically manage the layout of widgets. There are specific layout varieties: QHBoxLayout, QVBoxLayout, QGridLayout, etc.
  • Models The QAbstractItemModel and its derived classes QAbstractListModel and QAbstractTableModel are part of Qt's model/view framework, and are used as base classes for classes that represent data for a QListView, QTReeView, or QTableView.
  • Database models These are for use with QTableView (or other customized view classes) using SQL Databases as data sources: QSqlTableModel and QSqlRelationalModel.

To see more widgets rendered in different styles, check out TrollTech's Qt Widget Gallery1, which contains a variety of screenshots and source code for rendering the widgets in different styles.[1]

[1] http://oop.mcs.suffolk.edu/qtdocs/gallery.html

Part I: Introduction to C++ and Qt 4

C++ Introduction


Introduction to Qt



Inheritance and Polymorphism

Part II: Higher-Level Programming


Introduction to Design Patterns


Generics and Containers

Qt GUI Widgets


Validation and Regular Expressions

Parsing XML

Meta Objects, Properties, and Reflective Programming

More Design Patterns

Models and Views

Qt SQL Classes

Part III: C++ Language Reference

Types and Expressions

Scope and Storage Class

Statements and Control Structures

Memory Access

Chapter Summary

Inheritance in Detail

Miscellaneous Topics

Part IV: Programming Assignments

MP3 Jukebox Assignments

Part V: Appendices

MP3 Jukebox Assignments


MP3 Jukebox Assignments

show all menu

An Introduction to Design Patterns in C++ with Qt 4
An Introduction to Design Patterns in C++ with Qt 4
ISBN: 0131879057
EAN: 2147483647
Year: 2004
Pages: 268
Similar book on Amazon

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