-
tobiglaser authoredtobiglaser authored
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
ActionListener
s have to be used to register the click of a button. Rather a callback functionslot
isconnect
ed to an eventsignal
of the button.
SosetController()
doesn't instanciate any Listeners, butconnect
s the appropriateslot
s to the buttonsignal
s. - In Qt lists can be displayed either by a simplified
QListWidget
, or via a Model/View structure.-
QListWidget
can only holdQListWidgetItems
, - 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 itsCommandType
.
- Because of that the subclass
PanelCommandConfig
- For the Panels a
QStackedWidget
, comparable toCardLayout
is used. - The constants for switching between panels were moved into an
enum
. Enums are implicid integers, whileenum class
es have their own type. - The config panels are passed a pointer to the
ControlUI
and remember it to later callupdateTableView()
directly.
This could be changed to the signals&slots mentality of Qt. The panels would not have to know theControlUI
and would just emit asignal
to initiate the update. The connection would happed inControlUI.setController()
, just like with the other panels.