Qt Widgets
← Qt Introduction | ● | Qt Signal and Slots →
With Qt the user interface is assembled from small graphical objects the so called widgets. The grouping of several widgets in the GUI is controlled via so called Layouts, which assemble the widget elements in predefined order and control size constraints of the elements.
Each widget in turn can also contain a layout, so that the combination of widgets and layouts forms a user interface element hierarchy.
Each widget’s behavior is controlled by a C++ class object. Overriding the widgets’ methods allows to adapt off-the-shelf widgets to specific needs.
There is a rich collection of useful widgets available:
- QLineEdit
- QTextEdit
- QSlider
- QPushButton
- QDockWidget
- QMenu
- etc.
All widgets are derived from the base class QWidget.
We look at an example application with Qt that just uses an blank widget as a starting point:
#include <QtGui/QWidget>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget widget;
widget.show();
return(app.exec());
}
← Qt Introduction | ● | Qt Signal and Slots →