| 369 | } |
| 370 | |
| 371 | void KeypadWidget::mouseUpdate(const QPointF &pos) { |
| 372 | const QPainterPath area{pos * mInverseTransform}; |
| 373 | for (uint8_t row = 0; row != sRows; ++row) { |
| 374 | for (uint8_t col = 0; col != sCols; ++col) { |
| 375 | if (Key *key = mKeys[row][col]) { |
| 376 | bool wasSelected = key->isSelected(); |
| 377 | if (key->isUnder(area)) { |
| 378 | if (!mClicked.contains(key->keycode())) { |
| 379 | mClicked.insert(key->keycode()); |
| 380 | key->press(); |
| 381 | } |
| 382 | } else if (mClicked.remove(key->keycode())) { |
| 383 | key->release(); |
| 384 | } |
| 385 | updateKey(key, wasSelected); |
| 386 | } |
| 387 | } |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | void KeypadWidget::mouseEnd(bool toggleHeld) { |
| 392 | for (KeyCode code : mClicked) { |
nothing calls this directly
no test coverage detected