- The background (black-point) slider is hidden by default. It is shown from
View > Background slider, or as soon as the background becomes non-zero
(B + wheel), so an active background is never invisible. The choice is kept
in QSettings ("backgroundSlider") and cleared by "Reset all settings".
- Auto contrast, continuous or the one-shot A key, sets the background back
to zero.
- A dataset-info plot without a run colour kept the default QPen: black, and
near-invisible on the dark theme. This is every plot of a live HTTP dataset,
whose run list is empty. It now takes #1F77B4 on the light theme and
#FF7F0E on the dark one (the spots / background colours of the split plot).
Checked headlessly: the rendered line pixels are exactly those colours on
the #FFFFFF and #12142B plot backgrounds.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
83 lines
4.3 KiB
C++
83 lines
4.3 KiB
C++
// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#include "JFJochMouseShortcutsWindow.h"
|
|
|
|
#include <QTextBrowser>
|
|
#include <QVBoxLayout>
|
|
|
|
namespace {
|
|
struct Shortcut { QString action; QString effect; };
|
|
struct Section { QString title; QVector<Shortcut> rows; };
|
|
|
|
QString BuildHtml() {
|
|
// Qt reads the Command key as Ctrl on macOS, and a Mac keyboard often has no Home/End/Page keys
|
|
#ifdef Q_OS_MACOS
|
|
const QString ctrl = "Cmd (\u2318)";
|
|
const QString home_end = "Home / End (Fn + \u2190 / \u2192)";
|
|
const QString page_up_down = "Page Up / Page Down (Fn + \u2191 / \u2193)";
|
|
const QString right_click = "Right click (Ctrl + click)";
|
|
#else
|
|
const QString ctrl = "Ctrl";
|
|
const QString home_end = "Home / End";
|
|
const QString page_up_down = "Page Up / Page Down";
|
|
const QString right_click = "Right click";
|
|
#endif
|
|
const QVector<Section> sections = {
|
|
// JFJochImage / JFJochDiffractionImage mouse handling
|
|
{"Diffraction image", {
|
|
{"Wheel", "Zoom in / out, centred on the cursor"},
|
|
{"Shift + wheel", "Move the foreground (upper contrast limit) in linear steps"},
|
|
{ctrl + " + wheel", "Move the foreground in multiplicative steps (×1.15 per notch)"},
|
|
{"F held + wheel", "Same as Shift + wheel, for as long as F is held"},
|
|
{"B held + wheel", "Move the background (lower contrast limit) in linear steps, for as long as B is held; shows the background slider"},
|
|
{"A", "Apply auto-contrast once (background back to zero); press again to switch on continuous Auto"},
|
|
{home_end, "Jump to the first / last image in the dataset"},
|
|
{page_up_down, "Step one image forward / back"},
|
|
{"Hover", "Status bar shows the pixel position, its value and the resolution"},
|
|
{"Drag", "Pan the image"},
|
|
{"Shift + move", "Move the magnifier panel to the cursor; a frame shows the area it covers"},
|
|
{"Shift + drag", "Draw a rectangular ROI"},
|
|
{"Shift + " + ctrl + " + drag", "Draw a circular ROI"},
|
|
{"Drag an ROI or its handle", "Move or resize the selected ROI"},
|
|
{right_click, "Copy / save the image, fit to view, clear the ROI"},
|
|
}},
|
|
// JFJochGridScanImage
|
|
{"Grid scan", {
|
|
{"Hover", "Status bar shows the image number, the grid position and its value"},
|
|
{"Shift + hover", "Load the image under the cursor while moving over the grid"},
|
|
{"Double click", "Load the image under the cursor"},
|
|
}},
|
|
{"Other views", {
|
|
{"2D azimuthal image: double click", "Zoom the diffraction image on the corresponding detector position"},
|
|
{"Dataset-info plot: hover", "Status bar shows the image number and the plotted value"},
|
|
{"Dataset-info plot: Shift + hover", "Load the hovered image"},
|
|
{"Spot / reflection list: double click", "Zoom the diffraction image on that spot or prediction"},
|
|
{"Image list: double click", "Load that image"},
|
|
}},
|
|
};
|
|
|
|
QString html = "<html><body>";
|
|
for (const auto §ion : sections) {
|
|
html += "<h3>" + section.title + "</h3>";
|
|
html += "<table cellspacing='0' cellpadding='4' width='100%'>";
|
|
for (const auto &row : section.rows)
|
|
html += "<tr><td width='38%'><b>" + row.action + "</b></td><td>" + row.effect + "</td></tr>";
|
|
html += "</table>";
|
|
}
|
|
html += "</body></html>";
|
|
return html;
|
|
}
|
|
}
|
|
|
|
JFJochMouseShortcutsWindow::JFJochMouseShortcutsWindow(QWidget *parent) : QDialog(parent) {
|
|
setWindowTitle("Mouse Shortcuts");
|
|
resize(620, 620);
|
|
|
|
auto *browser = new QTextBrowser(this);
|
|
browser->setHtml(BuildHtml());
|
|
|
|
auto *layout = new QVBoxLayout(this);
|
|
layout->addWidget(browser);
|
|
}
|