Skip to content

Draft: Extract coordinate system ui

d.kilic requested to merge extract-coordinate-system-ui into master

This MR is an example on how to extract an group box out of control.ui into its own ui file with accompanying cpp and h files. It also adds a button to grey out the extracted group box.

The signal-slot-connection would technically function as is, since the widgets are still children of control after coordinateSystem is added to controls.ui. To make the connections more explicit, and to enable compile time errors on e.g. a rename of a widget, the connect syntax has been used introduced as well.

For each relevant signal of an widget (i.e. valueChanged of a specific slider) a signal of the CoordinateSystem class was created and will be propagated. These signals could be used by another class than control as well.

Methods inside of Control which accessed the widgets which are now part of CoordinateSystem, have been simplified to just call the according method in CoordinateSystem. Connections between widgets (e.g. disabling extrinsic calib, when the 2D tab is selected) are still managed by Control. Calls to mMainWindow still live in control as well.

Steps

  1. Make a new class with ui + cpp + h files (Inherit from e.g. QFrame)
  2. Copy the group box into the ui file of the new class and set a layout on the new class
  3. Make the original group box into a QFrame and delete all its child elements
  4. Promote the QFrame in control.ui to an instance of your new class
  5. Move all methods accessing the widgets into the new class and delegate to the new class inside of control
  6. Now everything should work as before
  7. (Use the explicit connect syntax instead of relying on connectSlotByName)

Related #277 (closed)

Merge request reports