| 358 | } |
| 359 | |
| 360 | void ClientRxChainWidget::mouseMoveEvent(QMouseEvent* ev) |
| 361 | { |
| 362 | if (m_pressIndex < 0 || !(ev->buttons() & Qt::LeftButton)) { |
| 363 | // Hover → cursor reflects whether the tile is interactive. |
| 364 | const int idx = hitTest(ev->position()); |
| 365 | const bool interactive = (idx >= 0) |
| 366 | && m_boxes[idx].kind == TileKind::Stage |
| 367 | && isStageImplemented(m_boxes[idx].stage); |
| 368 | setCursor(interactive ? Qt::PointingHandCursor : Qt::ArrowCursor); |
| 369 | QWidget::mouseMoveEvent(ev); |
| 370 | return; |
| 371 | } |
| 372 | // Distinguish drag from click — require ~6 px of movement. |
| 373 | if ((ev->position().toPoint() - m_pressPos).manhattanLength() < 6) return; |
| 374 | |
| 375 | const auto& b = m_boxes[m_pressIndex]; |
| 376 | auto* drag = new QDrag(this); |
| 377 | auto* mime = new QMimeData; |
| 378 | mime->setData(kMimeFormat, |
| 379 | QByteArray::number(static_cast<int>(b.stage))); |
| 380 | drag->setMimeData(mime); |
| 381 | |
| 382 | // Drag pixmap snapshot — same active treatment as the painted tile. |
| 383 | QPixmap pix(b.rect.size().toSize()); |
| 384 | pix.fill(Qt::transparent); |
| 385 | { |
| 386 | QPainter pp(&pix); |
| 387 | pp.setRenderHint(QPainter::Antialiasing, true); |
| 388 | pp.setBrush(kBgActive()); |
| 389 | pp.setPen(QPen(kBorderActive(), 1.0)); |
| 390 | pp.drawRoundedRect(QRectF(0, 0, pix.width() - 1, pix.height() - 1), |
| 391 | kRadius, kRadius); |
| 392 | QFont f = pp.font(); |
| 393 | f.setPixelSize(9); |
| 394 | f.setBold(true); |
| 395 | pp.setFont(f); |
| 396 | pp.setPen(kTextLabel()); |
| 397 | pp.drawText(pix.rect(), Qt::AlignCenter, stageLabel(b.stage)); |
| 398 | } |
| 399 | drag->setPixmap(pix); |
| 400 | drag->setHotSpot(QPoint(pix.width() / 2, pix.height() / 2)); |
| 401 | |
| 402 | // Cancel any pending click — mouseReleaseEvent won't fire for the |
| 403 | // drag end, but we want to be defensive. |
| 404 | if (m_clickTimer && m_clickTimer->isActive()) m_clickTimer->stop(); |
| 405 | m_pendingClickIdx = -1; |
| 406 | m_pressIndex = -1; |
| 407 | drag->exec(Qt::MoveAction); |
| 408 | m_dropIndex = -1; |
| 409 | update(); |
| 410 | } |
| 411 | |
| 412 | void ClientRxChainWidget::mouseReleaseEvent(QMouseEvent* ev) |
| 413 | { |
nothing calls this directly
no test coverage detected