Files
Jungfraujoch/viewer/widgets/CollapsibleSection.cpp
T
leonarski_fandClaude Opus 4.8 03ac43da69 viewer: panel polish — accordions, shared geometry, detector tilt, SG name
Declutter the side and settings panels (review items a–f):

- New CollapsibleSection widget (slim navy header + coral rule + chevron).
- Inspector: Image features / Resolution rings / ROI are now collapsible and
  start folded (ROI auto-expands when ROIs change); drop the Data-analysis and
  Powder-calibration sections (they live in the hero buttons and settings dock).
- Settings dock: move Geometry to a shared section above the MX/AzInt toggle
  (both communities need it); add Detector tilt (PONI rot1/rot2, deg) and
  rename "Beam center" -> "Beam origin" with PONI/XDS tooltips; show the
  space-group number and resolved Hermann–Mauguin symbol on one line; wrap
  sections in accordions, anchored top with a bottom stretch so expanding one
  does not shift the others.
- Toolbar: drop the redundant "Image number" label.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 16:26:15 +02:00

45 lines
1.4 KiB
C++

// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#include "CollapsibleSection.h"
#include <QToolButton>
#include <QVBoxLayout>
CollapsibleSection::CollapsibleSection(const QString &title, QWidget *parent) : QWidget(parent) {
auto *v = new QVBoxLayout(this);
v->setContentsMargins(0, 0, 0, 0);
v->setSpacing(0);
header_ = new QToolButton(this);
header_->setText(title);
header_->setCheckable(true);
header_->setChecked(true);
header_->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
header_->setArrowType(Qt::DownArrow);
header_->setCursor(Qt::PointingHandCursor);
header_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
header_->setStyleSheet(
"QToolButton { color:#1F3A5F; font-weight:bold; text-align:left;"
" padding:3px 6px 3px 6px; border:none;"
" border-left:3px solid #FA7268; border-bottom:1px solid #FA7268; background:transparent; }");
content_ = new QWidget(this);
v->addWidget(header_);
v->addWidget(content_);
connect(header_, &QToolButton::toggled, this, [this](bool on) {
content_->setVisible(on);
header_->setArrowType(on ? Qt::DownArrow : Qt::RightArrow);
});
}
void CollapsibleSection::setContentLayout(QLayout *layout) {
content_->setLayout(layout);
}
void CollapsibleSection::setExpanded(bool on) {
header_->setChecked(on);
}