9#include <QAbstractItemModel>
10#include <QApplication>
36 return m_zoomLevel > 0;
51 if (m_zoomLevel > 0) {
68 const int cols = m_view->model() ? m_view->model()->columnCount() : 0;
69 const int rows = m_view->model() ? m_view->model()->rowCount() : 0;
71 if (cols <= 0 || rows <= 0) {
75 auto *vHeader = m_view->verticalHeader();
76 auto *hHeader = m_view->horizontalHeader();
77 auto *vbar = m_view->verticalScrollBar();
78 auto *hbar = m_view->horizontalScrollBar();
84 const double interiorW = m_view->viewport()->width()
85 + vHeader->width() + (vbar->isVisible() ? vbar->width() : 0);
86 const double interiorH = m_view->viewport()->height()
87 + hHeader->height() + (hbar->isVisible() ? hbar->height() : 0);
94 const double availW = interiorW - vHeader->sizeHint().width();
95 const double availH = interiorH - hHeader->sizeHint().height();
99 if (sW <= 0 || sH <= 0) {
117 const double colScale = m_fitScale * std::pow(
kZoomStep, m_zoomLevel);
118 m_view->horizontalHeader()->setDefaultSectionSize(
120 m_view->verticalHeader()->setDefaultSectionSize(
125 QFont font = QApplication::font();
126 const double basePointSize = font.pointSizeF() > 0 ? font.pointSizeF() : 10.0;
127 font.setPointSizeF(basePointSize * m_fitScale);
128 m_view->setFont(font);
129 m_view->horizontalHeader()->setFont(font);
130 m_view->verticalHeader()->setFont(font);
static constexpr int kDefaultColumnWidth
Per-column pixel width at zoom 1.0 (matches the pre-refactor on-screen size).
static constexpr double kMaxFitScale
Largest allowed Fit Screen scale.
static constexpr int kMaxZoomLevel
Maximum discrete column-zoom step (baseline = 0).
static constexpr double kMinFitScale
Smallest allowed Fit Screen scale.
static constexpr double kZoomStep
Multiplicative factor per column-zoom step.
static constexpr double kFitEpsilon
Fit Screen scale convergence threshold.
static constexpr int kDefaultRowHeight
Per-row pixel height at zoom 1.0 (matches the pre-refactor on-screen size).
static constexpr int kFitIterations
Max passes to converge Fit Screen's fixed point.
DolphinZoom: zoom state and metrics for the beWavedDolphin waveform table.
bool canZoomIn() const
True if Zoom In is still possible (below the max level).
void zoomIn()
Increases the discrete column-zoom one step (capped) and re-applies.
void zoomOut()
Decreases the discrete column-zoom one step (floored at the baseline) and re-applies.
bool canZoomOut() const
True if Zoom Out is still possible (above the baseline).
void reset()
Resets both axes to the baseline (level 0, scale 1.0) and re-applies.
DolphinZoom(QTableView *view)
Constructs the zoom controller for view (not owned; must outlive this).
void apply() const
Applies the current zoom to the view's row/column section sizes and font.