| 894 | } |
| 895 | |
| 896 | bool WorksheetElementPrivate::sceneEvent(QEvent* event) { |
| 897 | // don't allow to move the element with the mouse or with the cursor keys if it's locked |
| 898 | // or if its not movable (ItemIsMovable blocks mouse moves only, we also need to block key press events), |
| 899 | // react on all other events |
| 900 | if ((lock && (event->type() == QEvent::GraphicsSceneMouseMove || event->type() == QEvent::KeyPress)) |
| 901 | || (!flags().testFlag(QGraphicsItem::ItemIsMovable) && event->type() == QEvent::KeyPress)) { |
| 902 | event->ignore(); |
| 903 | return true; |
| 904 | } |
| 905 | |
| 906 | return QGraphicsItem::sceneEvent(event); |
| 907 | } |
| 908 | |
| 909 | void WorksheetElementPrivate::keyPressEvent(QKeyEvent* event) { |
| 910 | const bool keyVertical = event->key() == Qt::Key_Up || event->key() == Qt::Key_Down; |