Meeting 11: Reuse through Composition

Today we will learn how to build up complex concepts and models from simple parts.

Links:

Exercise 11: Building Complex Widgets using Composition

GitHub Invitation URL: exercise11

Steps:

  1. Clone the assignment for today after accepting the GitHub invitation at the link above.

  2. Define and implement a class ComplexWidget in complex_widget.hpp and complex_widget.cpp that derives from QWidget and models a complex number. Include entry boxes of type QDoubleSpinBox for the real and imaginary part and display boxes of type QLineEdit for the magnitude and phase. The class should have public member functions getRealPart, getImaginaryPart, getMagnitude, and getPhase returning a double in each case.

  3. Write a main function in main.cpp that uses QApplication to instantiate the ComplexWidget, show it, then enter the event loop.

  4. Build and run your application using the CMakeLists.txt file included.

  5. Now, use git to commit the modified source files to the local repository.

  6. Finally, use git push to synchronize the repository with that on GitHub.

You have completed the Exercise.