From 9ba8096c0b625b7205cb7da614f8f08eec5dab60 Mon Sep 17 00:00:00 2001 From: leonarski_f Date: Tue, 23 Jun 2026 16:13:26 +0200 Subject: [PATCH] viewer: chart top margin + settings dock width bounds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - The chart top margin was too tight (2 px), so the highest Y-axis label overlapped the top edge; give it 10 px of room (both chart views). - The settings dock had no width constraints (unlike the inspector), so it stretched ugly when widened and would not fold back narrowly. Cap it to 330–480 px like the inspector. Co-Authored-By: Claude Opus 4.8 --- viewer/JFJochViewerWindow.cpp | 4 ++++ viewer/charts/JFJochDatasetInfoChartView.cpp | 2 +- viewer/charts/JFJochSimpleChartView.cpp | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/viewer/JFJochViewerWindow.cpp b/viewer/JFJochViewerWindow.cpp index 041e3fa0..2a496cec 100644 --- a/viewer/JFJochViewerWindow.cpp +++ b/viewer/JFJochViewerWindow.cpp @@ -501,6 +501,10 @@ JFJochViewerWindow::JFJochViewerWindow(QWidget *parent, bool dbus, const QString settingsScroll->setWidgetResizable(true); settingsScroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); settingsScroll->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); + // Constrain the width like the inspector, so it neither stretches ugly when widened nor + // refuses to fold back narrow. + settingsScroll->setMinimumWidth(330); + settingsScroll->setMaximumWidth(480); settingsDock = new QDockWidget("Settings", this); settingsDock->setObjectName("settingsDock"); settingsDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); diff --git a/viewer/charts/JFJochDatasetInfoChartView.cpp b/viewer/charts/JFJochDatasetInfoChartView.cpp index 46486046..1e65b1b8 100644 --- a/viewer/charts/JFJochDatasetInfoChartView.cpp +++ b/viewer/charts/JFJochDatasetInfoChartView.cpp @@ -16,7 +16,7 @@ JFJochDatasetInfoChartView::JFJochDatasetInfoChartView(QWidget *parent) // Reclaim Qt Charts' outer layout padding and trim the inner margins so the axis labels keep // their room even when the dock is short (otherwise they are the first thing Qt drops). chart()->layout()->setContentsMargins(0, 0, 0, 0); - chart()->setMargins(QMargins(2, 2, 6, 2)); + chart()->setMargins(QMargins(2, 10, 8, 2)); // top room so the highest Y label is not clipped chart()->setBackgroundRoundness(0); setRenderHint(QPainter::Antialiasing); // setRubberBand(QChartView::RubberBand::RectangleRubberBand); diff --git a/viewer/charts/JFJochSimpleChartView.cpp b/viewer/charts/JFJochSimpleChartView.cpp index 35b582fa..e5f7524f 100644 --- a/viewer/charts/JFJochSimpleChartView.cpp +++ b/viewer/charts/JFJochSimpleChartView.cpp @@ -14,7 +14,7 @@ JFJochSimpleChartView::JFJochSimpleChartView(QWidget *parent) : QChartView(new QChart(), parent) { chart()->legend()->hide(); chart()->layout()->setContentsMargins(0, 0, 0, 0); // reclaim padding for the plot + labels - chart()->setMargins(QMargins(2, 2, 6, 2)); + chart()->setMargins(QMargins(2, 10, 8, 2)); // top room so the highest Y label is not clipped setMinimumHeight(140); // soft floor: enough for the axis labels to stay readable setRenderHint(QPainter::Antialiasing); setMouseTracking(true);