Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
README.md 15.92 KiB

Computer Science 3 Lab Exercises C++

This repo documents the transition of the third Computer Science lab exercises from Java to C++. The Course is about programming concepts rather than a specific language.

Please note, that const has not been used everywhere possible in this codebase. To const and constexpr everything will be a good future exercise to hone programming skills.

Changes

Worksheet 4

PanelCommandTypes

  • When using Qt, no ActionListeners have to be used to register the click of a button. Rather a callback function slot is connected to an event signal of the button.
    So setController() doesn't instanciate any Listeners, but connects the appropriate slots to the button signals.
  • In Qt lists can be displayed either by a simplified QListWidget, or via a Model/View structure.
    • QListWidget can only hold QListWidgetItems,
    • Model/View can represent any data because the QAbstractItemModel is implemented by the user.
  • For the commandTypeList the widget was chosen.
    • Because of that the subclass ComTypeListWidgetItem had to be created to allow the Item to remember its CommandType.

PanelCommandConfig

  • For the Panels a QStackedWidget, comparable to CardLayout is used.
  • The constants for switching between panels were moved into an enum. Enums are implicid integers, while enum classes have their own type.
  • The config panels are passed a pointer to the ControlUI and remember it to later call updateTableView() directly.
    This could be changed to the signals&slots mentality of Qt. The panels would not have to know the ControlUI and would just emit a signal to initiate the update. The connection would happed in ControlUI.setController(), just like with the other panels.

PanelCommandTable