Skip to content

simulation_page.cpp

file src/app/dialogs/simulation_page.cpp ยท Applications

Implementation of SimulationPage, the Simulation tab of the settings dialog.

Source src/app/dialogs/simulation_page.cpp

Builds the widgets and moves values between them and the simulation fields of an io::Profile.

Namespaces

Namespace Description
nmeasim::app The Qt Widgets desktop application: the main window, its dock panels, the map, the instruments and the settings dialog, built on nmeasim::io.

Summary

File-local functions

Name Description
make_double() Creates a floating-point spin box configured for this page.
make_int() Creates an integer spin box configured for this page, with keyboard tracking off like make_double.
shows() Returns whether a spin box still shows a value, as rounded to its decimals.
unless_unchanged() Returns the stored value when a spin box still shows it, and the spin box value otherwise.

File-local functions

make_double()

QDoubleSpinBox* make_double(
    QWidget* parent,
    double minimum,
    double maximum,
    double step,
    int decimals,
    const QString& suffix = {})

Creates a floating-point spin box configured for this page.

Keyboard tracking is off, so the value changes when the operator finishes typing rather than on every keystroke.

Parameters

Name Type Description
parent QWidget* The owner of the new spin box; must not be null, or the spin box leaks.
minimum double The smallest value the spin box accepts.
maximum double The largest value the spin box accepts.
step double The change applied by the arrow buttons and keys.
decimals int The number of decimals shown; values are rounded to it.
suffix const QString& Unit text shown after the value, such as " kn"; empty for none.

Returns QDoubleSpinBox*: The new spin box, owned by parent.

Declared in src/app/dialogs/simulation_page.cpp:44

make_int()

QSpinBox* make_int(QWidget* parent, int minimum, int maximum, const QString& suffix = {})

Creates an integer spin box configured for this page, with keyboard tracking off like make_double.

Parameters

Name Type Description
parent QWidget* The owner of the new spin box; must not be null, or the spin box leaks.
minimum int The smallest value the spin box accepts.
maximum int The largest value the spin box accepts.
suffix const QString& Unit text shown after the value, such as " ms"; empty for none.

Returns QSpinBox*: The new spin box, owned by parent.

Declared in src/app/dialogs/simulation_page.cpp:63

shows()

bool shows(const QDoubleSpinBox& spin, double value)

Returns whether a spin box still shows a value, as rounded to its decimals.

Parameters

Name Type Description
spin const QDoubleSpinBox& The spin box.
value double Value that was loaded into the spin box.

Returns bool: true when value, rounded to the decimals of spin, equals the spin box value, so that the operator did not change the field.

Declared in src/app/dialogs/simulation_page.cpp:77

unless_unchanged()

double unless_unchanged(double stored, const QDoubleSpinBox& spin)

Returns the stored value when a spin box still shows it, and the spin box value otherwise.

Keeps the decimals beyond those the spin box shows when the operator did not change the field.

Parameters

Name Type Description
stored double Value that was loaded into the spin box.
spin const QDoubleSpinBox& The spin box.

Returns double: stored when shows holds, else the value of spin.

Declared in src/app/dialogs/simulation_page.cpp:91