Files
Jungfraujoch/viewer/windows/JFJochMouseShortcutsWindow.cpp
T
Filip LeonarskiandClaude Opus 5.5 e07667726e
Build Packages / Create release (push) Successful in 28s
Build Packages / build:viewer:macos-arm64:nocuda (push) Successful in 2m54s
Build Packages / build:rugnux:macos-arm64:nocuda (push) Successful in 2m25s
Build Packages / build:viewer:linux-x86_64:nocuda (push) Successful in 11m31s
Build Packages / build:viewer:linux-x86_64:cuda (push) Successful in 12m3s
Build Packages / build:rugnux:linux-x86_64:cuda (push) Successful in 8m18s
Build Packages / build:rugnux:linux-aarch64:cuda (push) Successful in 6m19s
Build Packages / build:viewer:windows-x86_64:nocuda (push) Successful in 17m31s
Build Packages / build:viewer:windows-x86_64:cuda (push) Successful in 20m8s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 23m21s
Build Packages / build:jfjoch:rocky8:nocuda (push) Successful in 14m5s
Build Packages / build:jfjoch:rocky9:nocuda (push) Successful in 15m27s
Build Packages / build:jfjoch:ubuntu2204:nocuda (push) Successful in 14m45s
Build Packages / build:jfjoch:ubuntu2404:nocuda (push) Successful in 13m42s
Build Packages / build:rugnux:windows-x86_64:cuda (push) Successful in 11m13s
Build Packages / build:jfjoch:rocky8:cuda-sls9 (push) Successful in 15m11s
Build Packages / Generate python client (push) Successful in 27s
Build Packages / Build documentation (push) Successful in 1m17s
Build Packages / build:jfjoch:rocky9:cuda-sls9 (push) Successful in 16m20s
Build Packages / build:jfjoch:rocky8:cuda (push) Successful in 17m55s
Build Packages / build:jfjoch:ubuntu2404:cuda (push) Successful in 16m34s
Build Packages / build:jfjoch:ubuntu2204:cuda (push) Successful in 17m34s
Build Packages / build:jfjoch:rocky9:cuda (push) Successful in 18m4s
Build Packages / Unit tests (push) Successful in 1h20m54s
Viewer: Shift + wheel on macOS, Mac keys in the mouse-shortcut help
macOS turns Shift + a vertical mouse wheel into horizontal scrolling, so
the notch arrives in angleDelta().x() and y() is 0; the contrast step
read only y and did nothing. The wheel handler now takes whichever axis
carries the notch, for zoom, foreground and background alike.

Help > Mouse Shortcuts names Cmd for Ctrl on macOS (Qt maps Command to
Ctrl), Ctrl-click for right click and Fn + arrows for Home/End/Page
Up/Down, and lists B held + wheel, which was missing. The magnifier's
tooltip says how to drive it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 22:20:18 +02:00

83 lines
4.2 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 (&times;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"},
{"A", "Apply auto-contrast once; 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 &section : 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);
}