| 329 | } |
| 330 | |
| 331 | void KeypadWidget::paintEvent(QPaintEvent *event) { |
| 332 | QRegion region{mInverseTransform.map(event->region())}; |
| 333 | QPainter painter{this}; |
| 334 | painter.setRenderHint(QPainter::Antialiasing); |
| 335 | if (color == KEYPAD_CRYSTALCLEAR) { |
| 336 | painter.fillRect(this->rect(), cclrBackground); |
| 337 | } |
| 338 | painter.setTransform(mTransform); |
| 339 | painter.fillPath(keypadPath, mBackground); |
| 340 | for (uint8_t row = 0; row != sRows; ++row) { |
| 341 | for (uint8_t col = 0; col != sCols; ++col) { |
| 342 | if (const Key *key = mKeys[row][col]) { |
| 343 | if (region.intersects(key->textGeometry() | key->keyGeometry())) { |
| 344 | key->paint(painter); |
| 345 | } |
| 346 | } |
| 347 | } |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | void KeypadWidget::changeKeyState(KeyCode code, bool press) { |
| 352 | if (Key *key = mKeys[code.row()][code.col()]) { |