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

Method mouseMoveEvent

src/frontend/worksheet/WorksheetView.cpp:940–982  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

938}
939
940void WorksheetView::mouseMoveEvent(QMouseEvent* event) {
941 if (m_suppressSelectionChangedEvent)
942 return QGraphicsView::mouseMoveEvent(event);
943 if (m_mouseMode == MouseMode::Selection && m_cartesianPlotMouseMode != CartesianPlot::MouseMode::Selection) {
944 // check whether there is a cartesian plot under the cursor
945 // and set the cursor appearance according to the current mouse mode for the cartesian plots
946 if (plotAt(event->pos())) {
947 if (m_cartesianPlotMouseMode == CartesianPlot::MouseMode::ZoomSelection)
948 setCursor(Qt::CrossCursor);
949 else if (m_cartesianPlotMouseMode == CartesianPlot::MouseMode::ZoomXSelection)
950 setCursor(Qt::SizeHorCursor);
951 else if (m_cartesianPlotMouseMode == CartesianPlot::MouseMode::ZoomYSelection)
952 setCursor(Qt::SizeVerCursor);
953 } else
954 setCursor(Qt::ArrowCursor);
955 } else if (m_mouseMode == MouseMode::Selection && m_cartesianPlotMouseMode == CartesianPlot::MouseMode::Selection)
956 setCursor(Qt::ArrowCursor);
957 else if (m_selectionBandIsShown) {
958 QRect rect = QRect(m_selectionStart, m_selectionEnd).normalized();
959 m_selectionEnd = event->pos();
960 rect = rect.united(QRect(m_selectionStart, m_selectionEnd).normalized());
961 qreal penWidth = 5 / transform().m11();
962 rect.setX(rect.x() - penWidth);
963 rect.setY(rect.y() - penWidth);
964 rect.setHeight(rect.height() + 2 * penWidth);
965 rect.setWidth(rect.width() + 2 * penWidth);
966 viewport()->repaint(rect);
967 }
968
969 // show the magnification window
970 if (magnificationFactor /*&& m_mouseMode == SelectAndEditMode*/) {
971 if (!m_magnificationWindow) {
972 m_magnificationWindow = new QGraphicsPixmapItem(nullptr);
973 m_magnificationWindow->setZValue(std::numeric_limits<int>::max());
974 scene()->addItem(m_magnificationWindow);
975 }
976
977 updateMagnificationWindow(mapToScene(event->pos()));
978 } else if (m_magnificationWindow)
979 m_magnificationWindow->setVisible(false);
980
981 QGraphicsView::mouseMoveEvent(event);
982}
983
984/*!
985 * Updates the magnified content of the scene under the cursor that is shown in the magnification window.

Callers

nothing calls this directly

Calls 10

setXMethod · 0.80
xMethod · 0.80
setYMethod · 0.80
setHeightMethod · 0.80
heightMethod · 0.80
yMethod · 0.45
setWidthMethod · 0.45
widthMethod · 0.45
setZValueMethod · 0.45
setVisibleMethod · 0.45

Tested by

no test coverage detected