/** * Process the keyboard key press event. */ void InputControllerDrawShape::keyPressEvent(QKeyEvent *event) { switch(event->key()) { case Qt::Key_Delete: case Qt::Key_Backspace: emit removeSelectedShapes(); break; } }
void CustomGraphicsScene::removeAllShapes() { QPainterPath path; path.addRect(this->sceneRect()); setSelectionArea(path); removeSelectedShapes(); this->clear(); QGraphicsRectItem *item; addItem(item = new QGraphicsRectItem(QRectF(0,0,10000,10000))); item->setVisible(false); }