UNISA Chatter – Design patterns in C++ Part 4: Widgets … getting started with the QT User Interface
See UNISA – Summary of 2010 Posts for a list of related UNISA posts. Continued from UNISA Chatter – UNISA Chatter – Design patterns in C++ Part 3: Generics & Serializer Pattern .
QT and Environment Summary
The following is a summary of findings as I worked through the course related book. See the summary post for details on the book.
Terminology | Description | Example |
QWidget | Class using multiple inheritance, as shown, making it paintable and an object that can have parents and all the other goodies shipped with QObject. There are different classes of QWidgets:
|
|
QMainWindow | QMainWindow is the mother of all windows, the main window, and therefore the parent of all other widgets in the main window. Most QApplication objects, we introduced in previous posts, manage one of these QMainWindow objects. |
|
QSettings | QSettings is used to save and restore application state, using a persistent map of value and key pairs. |
|
QMessageBox | Something that I am pondering over, but actually liking, is the apparent overlap and similarity with Win32 and .NET classes. The QMessageBox just brought back so many memories … it is used, as in the other mentioned environments, to popup a standard dialog. |
QMessageBox::question(this,”if it is neither here nor there, where is it?”, “interesting”, 0, –1); |
Images and Resources | To include binary files, such as images, in our Qt application we follow a few easy steps:
… or we can simply use the IDE. |
See the sample solution for examples. |
Layout | To control the layout of the windows we can use the following classes, amongst others:
|
See the sample solution for examples. |
Design Pattern Summary
Terminology | Description |
Pattern: Monostate | |
Pattern: Command |
The will post the sample solution I developed as soon as I submit the assignment, which use most of the QT features summarised above. When I am done with UNISA, I will probably rewrite all of these samples using Visual Studio 2010 and demonstrate the phenomenal features and productivity of that environment as well.
Here are a few screen shots, which should highlight the favourite sample program emerging through the technology forest once again:
I once had lots of fun writing the code and debugging the gremlins and odd behaviours using the QT IDE. Not sure what the problem is, but there are often locked files, especially after a debug session, forcing an IDE restart … brings back memories from very early Visual Studio builds and can be rather tiring late at night.
Next post will explore the QVC pattern … a pattern that has also settled firmly in Visual Studio 2010 samples. If only we could complete these assignments using Visual Studio 2010 :|
Comments
- Anonymous
October 11, 2010
The comment has been removed - Anonymous
October 12, 2010
I slotted the MonoState into the creational category due to its similiarities with the Singletion pattern, which is also a creational pattern.