| 7227 | } |
| 7228 | |
| 7229 | void SpectrumWidget::mouseDoubleClickEvent(QMouseEvent* ev) |
| 7230 | { |
| 7231 | const int chromeH = freqScaleH() + DIVIDER_H; |
| 7232 | const int contentH = height() - chromeH; |
| 7233 | const int specH = static_cast<int>(contentH * m_spectrumFrac); |
| 7234 | const int wfY = specH + DIVIDER_H + freqScaleH(); |
| 7235 | const int y = static_cast<int>(ev->position().y()); |
| 7236 | const int mx = static_cast<int>(ev->position().x()); |
| 7237 | const int rightStripW = (y >= wfY) ? waterfallStripWidth() : DBM_STRIP_W; |
| 7238 | |
| 7239 | // Consume double-clicks on the dBm and time strips |
| 7240 | if (mx >= width() - rightStripW) { |
| 7241 | ev->accept(); |
| 7242 | return; |
| 7243 | } |
| 7244 | |
| 7245 | // Double-click on off-screen slice indicator → recenter on that slice |
| 7246 | for (int oi = 0; oi < m_offScreenRects.size(); ++oi) { |
| 7247 | if (!m_offScreenRects[oi].isNull() && m_offScreenRects[oi].contains(QPoint(mx, y))) { |
| 7248 | m_centerMhz = m_sliceOverlays[oi].freqMhz; |
| 7249 | markOverlayDirty(); |
| 7250 | emit centerChangeRequested(m_centerMhz); |
| 7251 | // Suppress the second mouseRelease's single-click-to-tune emit |
| 7252 | // (Qt fires Press → Release → DoubleClick → Release; without this |
| 7253 | // flag the trailing release would re-tune against the new |
| 7254 | // center, landing roughly bandwidth/2 away from the slice). #2237 |
| 7255 | m_spotClickConsumed = true; |
| 7256 | ev->accept(); |
| 7257 | return; |
| 7258 | } |
| 7259 | } |
| 7260 | |
| 7261 | // Double-click in FFT or waterfall → tune to clicked frequency |
| 7262 | if (y < specH || y >= wfY) { |
| 7263 | const double startMhz = m_centerMhz - m_bandwidthMhz / 2.0; |
| 7264 | double rawMhz = startMhz + (ev->position().x() / width()) * m_bandwidthMhz; |
| 7265 | |
| 7266 | emit frequencyClicked(snapToStep(rawMhz, m_stepHz)); |
| 7267 | ev->accept(); |
| 7268 | return; |
| 7269 | } |
| 7270 | |
| 7271 | QWidget::mouseDoubleClickEvent(ev); |
| 7272 | } |
| 7273 | |
| 7274 | void SpectrumWidget::leaveEvent(QEvent* event) |
| 7275 | { |
nothing calls this directly
no test coverage detected