Graphics and user interfaces in C++ with Qt

Ken Hartness · Journal of computing sciences in colleges · 2005

Graphical user interfaces are often not covered in a programming language course. One exception seems to be Java, possibly because it provides a standard for graphical user interface development regardless of the computer being used. However, students new to programming come from using software largely dependent on graphical user interfaces and write software that looks quite dull by comparison. On the other hand, most instructors are familiar with the student who submits a wonderful looking program, above and beyond the call of duty, that fails to fulfill the requirements of the assignment; they have no desire to replace software design, algorithm implementation, and data structure selection and implementation with the art of making programs prettier. Qt is a cross-platform graphical user interface library that now comes with a user interface design tool that generates C++ code. The library is designed in a clear, object-oriented fashion. The only extension to C++ is the use of a slot and signal metaphor for connecting user interface events (signals) to one of the methods (slots) of an object that responds to the event. The only difference between a standard C++ application and a Qt GUI application is the creation and invocation of a QApplication object that handles the typical event message loop. Because of its object-oriented design, it is quite easy to teach students the use of objects since the things they create and manipulate are visible elements on the display. It has a straightforward set of simple graphics functions as well as support for OpenGL, so a wide range of graphics projects are possible. The tutorial will introduce attendees to simple user interface creation in Qt, basic graphics tools provided by the library, and an example used to teach polymorphism in the presenter's CS 2 course (source code will be made available to attendees).

Read the paper · More papers on PaperTik