| 894 | } |
| 895 | |
| 896 | void WorksheetView::mousePressEvent(QMouseEvent* event) { |
| 897 | // prevent the deselection of items when context menu event |
| 898 | // was triggered (right button click) |
| 899 | if (event->button() == Qt::RightButton) { |
| 900 | event->accept(); |
| 901 | return; |
| 902 | } |
| 903 | |
| 904 | if (event->button() == Qt::LeftButton && m_mouseMode == MouseMode::ZoomSelection) { |
| 905 | m_selectionStart = event->pos(); |
| 906 | m_selectionEnd = m_selectionStart; // select&zoom'g starts -> reset the end point to the start point |
| 907 | m_selectionBandIsShown = true; |
| 908 | QGraphicsView::mousePressEvent(event); |
| 909 | return; |
| 910 | } |
| 911 | |
| 912 | // select the worksheet in the project explorer if the view was clicked |
| 913 | // and there is no selection currently. We need this for the case when |
| 914 | // there is a single worksheet in the project and we change from the project-node |
| 915 | // in the project explorer to the worksheet-node by clicking the view. |
| 916 | if (scene()->selectedItems().isEmpty()) |
| 917 | m_worksheet->setSelectedInView(true); |
| 918 | |
| 919 | QGraphicsView::mousePressEvent(event); |
| 920 | } |
| 921 | |
| 922 | void WorksheetView::mouseReleaseEvent(QMouseEvent* event) { |
| 923 | if (event->button() == Qt::LeftButton && m_mouseMode == MouseMode::ZoomSelection) { |
nothing calls this directly
no test coverage detected