MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / restoreSourceTimelineViewState

Method restoreSourceTimelineViewState

pj_app/src/MainWindow.cpp:3618–3649  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3616}
3617
3618void MainWindow::restoreSourceTimelineViewState(const QDomElement& element) {
3619 if (source_timeline_ == nullptr) {
3620 return;
3621 }
3622 const layout_xml::SourceTimelineViewState state = layout_xml::readSourceTimelineViewState(element);
3623 // Zoom first: it rebuilds the scene (width + scrollbar range), so the scroll
3624 // restore below maps onto the intended zoom.
3625 if (state.zoom) {
3626 source_timeline_->setZoom(*state.zoom);
3627 }
3628 if (state.scroll_left_ns) {
3629 source_timeline_->setViewportLeftDisplayNs(*state.scroll_left_ns);
3630 }
3631 if (state.name_column_width) {
3632 // Remember it so the deferred alignNameColumnToPlayback keeps the column at
3633 // this width (over the playback-aligned floor), then apply it now.
3634 timeline_name_column_width_ = *state.name_column_width;
3635 source_timeline_->resizeNameColumn(*state.name_column_width);
3636 }
3637 if (state.snap) {
3638 // Drive the rail toggle so its checked state and the widget stay in sync
3639 // (toggled -> Timeline::setSnapEnabled). Fall back to the widget directly.
3640 auto* btn = ui_->timelineAlignRail != nullptr
3641 ? ui_->timelineAlignRail->findChild<QToolButton*>(QStringLiteral("buttonTimelineSnap"))
3642 : nullptr;
3643 if (btn != nullptr) {
3644 btn->setChecked(*state.snap);
3645 } else {
3646 source_timeline_->setSnapEnabled(*state.snap);
3647 }
3648 }
3649}
3650
3651QDomElement MainWindow::saveRightPanelState(QDomDocument& doc) const {
3652 QDomElement element = doc.createElement(QStringLiteral("right_panel_state"));

Callers

nothing calls this directly

Calls 6

setZoomMethod · 0.80
resizeNameColumnMethod · 0.80
setSnapEnabledMethod · 0.80
setCheckedMethod · 0.45

Tested by

no test coverage detected