MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / setPlotTimeRange

Method setPlotTimeRange

app/src/UI/Dashboard.cpp:1146–1172  ·  view source on GitHub ↗

* @brief Sets the visible plot time window in seconds and notifies time-axis plots. */

Source from the content-addressed store, hash-verified

1144 * @brief Sets the visible plot time window in seconds and notifies time-axis plots.
1145 */
1146void UI::Dashboard::setPlotTimeRange(const double seconds)
1147{
1148 const double clamped = qMax(0.001, seconds);
1149 if (qFuzzyCompare(m_plotTimeRange, clamped))
1150 return;
1151
1152 m_plotTimeRange = clamped;
1153
1154 if (AppState::instance().operationMode() != SerialStudio::ProjectFile)
1155 m_settings.setValue("Dashboard/PlotTimeRange", m_plotTimeRange);
1156
1157 auto savedPlotRings = snapshotPlotTimeRings();
1158 auto savedMultiplotRings = snapshotMultiplotTimeRings();
1159 const auto savedPlotSweep = m_plotSweep;
1160 const auto savedMultiplotSweep = m_multiplotSweep;
1161
1162 configureLineSeries();
1163 configureMultiLineSeries();
1164
1165 restorePlotTimeRings(savedPlotRings);
1166 restoreMultiplotTimeRings(savedMultiplotRings);
1167 restorePlotSweepConfig(savedPlotSweep);
1168 restoreMultiplotSweepConfig(savedMultiplotSweep);
1169
1170 m_updateRequired = true;
1171 Q_EMIT plotTimeRangeChanged();
1172}
1173
1174/**
1175 * @brief Toggles whether dashboard preference changes are written to QSettings.

Callers 3

beginSessionMethod · 0.45
endSessionMethod · 0.45
setTimeRangeMethod · 0.45

Calls 1

operationModeMethod · 0.80

Tested by

no test coverage detected