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

Method alignNameColumnToPlayback

pj_app/src/MainWindow.cpp:3749–3772  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3747}
3748
3749void MainWindow::alignNameColumnToPlayback() {
3750 if (source_timeline_ == nullptr || ui_->timelineWidget == nullptr) {
3751 return;
3752 }
3753 // The playback slider's groove has margin 0 (QSS), so the slider widget's left
3754 // edge is where the blue track starts. Its x within the playback bar — which
3755 // shares the bottom panel's left origin with the name column — is the column
3756 // width that lines the separator up exactly under that track start.
3757 auto* slider = ui_->timelineWidget->findChild<QWidget*>(QStringLiteral("timeSlider"));
3758 if (slider == nullptr) {
3759 return;
3760 }
3761 const int slider_x = slider->mapTo(ui_->timelineWidget, QPoint(0, 0)).x();
3762 if (slider_x <= 0) {
3763 return; // playback bar not laid out yet (pre first show)
3764 }
3765 // slider_x is the floor (separator under the playback track start). If the user
3766 // widened the column (or a layout restored a wider width), re-apply it on top
3767 // so the column keeps its chosen width rather than snapping back to the floor.
3768 source_timeline_->setNameColumnWidth(slider_x);
3769 if (timeline_name_column_width_ > slider_x) {
3770 source_timeline_->resizeNameColumn(timeline_name_column_width_);
3771 }
3772}
3773
3774void MainWindow::restoreRightPanelState(const QDomElement& element) {
3775 if (element.isNull() || element.tagName() != QStringLiteral("right_panel_state")) {

Callers

nothing calls this directly

Calls 4

setNameColumnWidthMethod · 0.80
resizeNameColumnMethod · 0.80
QPointClass · 0.50
xMethod · 0.45

Tested by

no test coverage detected