MCPcopy Create free account
hub / github.com/KDE/labplot / mousePressEvent

Method mousePressEvent

src/frontend/worksheet/WorksheetView.cpp:896–920  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

894}
895
896void 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
922void WorksheetView::mouseReleaseEvent(QMouseEvent* event) {
923 if (event->button() == Qt::LeftButton && m_mouseMode == MouseMode::ZoomSelection) {

Callers

nothing calls this directly

Calls 5

buttonMethod · 0.80
acceptMethod · 0.80
selectedItemsMethod · 0.80
isEmptyMethod · 0.45
setSelectedInViewMethod · 0.45

Tested by

no test coverage detected