Reposition VFO widgets. paintEvent() is compiled only in software mode (#else !AETHER_GPU_SPECTRUM), so in GPU mode this is the sole place VFOs are repositioned. Logic mirrors the paintEvent() block below exactly. Called from renderGpuFrame BEFORE the flag-layer render so a dragged flag's snapshot is rasterized at this frame's position (no one-frame lag). (#3617)
| 9249 | // from renderGpuFrame BEFORE the flag-layer render so a dragged flag's snapshot |
| 9250 | // is rasterized at this frame's position (no one-frame lag). (#3617) |
| 9251 | void SpectrumWidget::repositionVfoFlags(const QRect& specRect) |
| 9252 | { |
| 9253 | QVector<VfoPos> vfos; |
| 9254 | for (const auto& so : m_sliceOverlays) { |
| 9255 | if (auto* vw = m_vfoWidgets.value(so.sliceId, nullptr)) { |
| 9256 | int x = mhzToX(so.freqMhz); |
| 9257 | if (so.mode == "RTTY" || so.mode == "DIGL") { |
| 9258 | double hiMhz = so.freqMhz + so.filterHighHz / 1.0e6; |
| 9259 | x = mhzToX(hiMhz) + 4; |
| 9260 | } |
| 9261 | vfos.append({so.sliceId, x, vw, so.splitPartnerId, &so}); |
| 9262 | } |
| 9263 | } |
| 9264 | std::sort(vfos.begin(), vfos.end(), [](const VfoPos& a, const VfoPos& b) { |
| 9265 | return a.x < b.x; |
| 9266 | }); |
| 9267 | |
| 9268 | const int panelW = vfos.isEmpty() ? 0 : vfos[0].w->width(); |
| 9269 | const int specW = specRect.width(); |
| 9270 | |
| 9271 | QMap<int, VfoWidget::FlagDir> dirMap; |
| 9272 | assignDiversityPairDirections(vfos, dirMap); |
| 9273 | assignSplitPairDirections(vfos, dirMap); |
| 9274 | assignModeForcedDirections(m_sliceOverlays, dirMap); |
| 9275 | |
| 9276 | if (vfos.size() == 1) { |
| 9277 | VfoWidget::FlagDir dir = dirMap.value(vfos[0].sliceId, VfoWidget::Auto); |
| 9278 | if (!dirMap.contains(vfos[0].sliceId) && vfos[0].overlay) { |
| 9279 | dir = singleVfoFlagDirectionForOverlay( |
| 9280 | *vfos[0].overlay, vfos[0].w, vfos[0].x, specW); |
| 9281 | } |
| 9282 | vfos[0].w->updatePosition(vfos[0].x, specRect.top(), dir); |
| 9283 | } else { |
| 9284 | for (int i = 0; i < vfos.size(); ++i) { |
| 9285 | VfoWidget::FlagDir dir = VfoWidget::Auto; |
| 9286 | if (dirMap.contains(vfos[i].sliceId)) { |
| 9287 | dir = dirMap[vfos[i].sliceId]; |
| 9288 | } else { |
| 9289 | dir = deconflictedVfoFlagDirection(vfos, i, panelW, specW); |
| 9290 | } |
| 9291 | vfos[i].w->updatePosition(vfos[i].x, specRect.top(), dir); |
| 9292 | } |
| 9293 | } |
| 9294 | } |
| 9295 | |
| 9296 | void SpectrumWidget::render(QRhiCommandBuffer* cb) |
| 9297 | { |
nothing calls this directly
no test coverage detected