This article turns from http://www.cnblogs.com/aqxin/archive/2011/05/23/2054156.html
The
Qwidget class is the base class for all user-interface objects. A widget is a basic unit of the user interface: it receives mouse, keyboard, and other events from the window system and draws itself on the screen. Each widget is rectangular, and they are arranged in the z-axis order. A widget can be partially covered by its parent window part or by a window part in front of it. the
qmainwindow class provides a main application window with a menu bar, an anchor window (such as a toolbar), and a status bar. The main window is typically used to provide a large central widget (such as text editing or drawing the canvas) along with the surrounding menus, toolbars, and a status bar. Qmainwindow is often inherited because it makes it easier to encapsulate central parts, menus and toolbars, as well as window status bars, which are called when the user taps a menu item or a toolbar button. The
qdialog class is the base class for dialog Windows. A dialog window is a top-level window that is primarily used for short-term tasks and for brief communication with users. Qdialog can be modal dialogs or non-modal dialog boxes. Qdialog supports extensibility and can provide return values. They can have default buttons. Qdialog can also have a qsizegrip in the lower right corner of it, using setsizegripenabled (). &NBSP
qdialog are the most common top-level windows. A widget that is not embedded in the parent widget is called a top-level widget. Typically, a top-level widget is a window with frames and title bars (although a certain window part tag is used, it may not be possible to create a top-level window part.) In Qt, the Qmainwindow and different qdialog subclasses are the most common top-level windows.
If it is a top-level dialog box, it is created based on Qdialog, and if it is the main form, it is based on Qmainwindow, if it is not, or if it is possible to be a top-level form, or possibly embedded in another form, is created based on Qwidget.
Of course, in practice, you can also derive based on any other part class. See the actual needs, such as Qframe, Qstackedwidget and so on.
Note: excerpted from
Http://www.kuqin.com/qtdocument/qwidget.html#details
Http://www.kuqin.com/qtdocument/qmainwindow.html#details
Http://www.kuqin.com/qtdocument/qdialog.html
The difference between Qwidget, Qdialog and Qmainwindow in QT