Tuesday, August 05, 2008

Qt - Programming In Qt

The primary prerequisite of learning Qt is C++. As already stated that Qt builds on the libraries of C++, it is vital to know the concepts of C++ like classes; private, protected and public members; inheritance, etc.

Like any traditional C++ program, the execution of a Qt program also starts from the function main(). A few enhancements do exist for Qt such as Signals And Slots. These are primarily responsible to establish connectivity between various widgets of the application.

Every Qt program consists of an application and several widgets built inside it.

Main Classes of Qt

Qt is based on widgets and intercommunication. A widget is any component with which a user can interact. It can be a button, a text box, anything. Complex widgets can be created from simpler ones.

Like any GUI toolkit, even Qt has several predefined widgets, namely QPushButton, QRadioButton, QCheckBox, QLabel, QLineEdit, QLCDNumber, QSlider, etc.

An entire list of Qt classes can be found in the help documentation of Qt, under the section Qt’s classes.

Writing A Program

The primary steps to be followed while writing a program are

  • Define the problem properly
  • Make sure what the widgets used will be, and how they are interconnected

Every Qt program is an application and is created from QApplication class. Further widgets are created and are attached to this application. And later the application is displayed. Generally simpler widgets are combined to form a complex widget, which is then used in the program.

No comments: