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

Method mouseModeChanged

src/frontend/datapicker/DatapickerImageView.cpp:602–648  ·  view source on GitHub ↗

############################################################################## #################################### SLOTs ############################### ##############################################################################

Source from the content-addressed store, hash-verified

600// #################################### SLOTs ###############################
601// ##############################################################################
602void DatapickerImageView::mouseModeChanged(QAction* action) {
603 const auto mode = (DatapickerImageView::MouseMode)action->data().toInt();
604
605 if (action == navigationModeAction) {
606 setInteractive(false);
607 setDragMode(QGraphicsView::ScrollHandDrag);
608 m_image->setSegmentsHoverEvent(false);
609 } else if (action == zoomSelectionModeAction) {
610 setInteractive(false);
611 setDragMode(QGraphicsView::NoDrag);
612 m_image->setSegmentsHoverEvent(false);
613 setCursor(Qt::ArrowCursor);
614 } else {
615 setInteractive(true);
616 setDragMode(QGraphicsView::NoDrag);
617 m_image->setSegmentsHoverEvent(true);
618 setCursor(Qt::CrossCursor);
619 if (currentPlotPointsTypeAction != action) {
620 switch (m_mouseMode) {
621 case DatapickerImageView::MouseMode::ReferencePointsEntry: {
622 int count = m_image->childCount<DatapickerPoint>(AbstractAspect::ChildIndexFlag::IncludeHidden);
623 if (count) {
624 auto button = QMessageBox::question(this,
625 i18n("Remove existing reference points?"),
626 i18n("All available reference points will be removed. Do you want to continue?"));
627 if (button != QMessageBox::Yes) {
628 // Reset back to the old one
629 currentPlotPointsTypeAction->setChecked(true);
630 return;
631 }
632 }
633
634 m_image->setPlotPointsType(DatapickerImage::PointsType::AxisPoints);
635 break;
636 }
637 case DatapickerImageView::MouseMode::CurvePointsEntry:
638 m_image->setPlotPointsType(DatapickerImage::PointsType::CurvePoints);
639 break;
640 case DatapickerImageView::MouseMode::CurveSegmentsEntry:
641 m_image->setPlotPointsType(DatapickerImage::PointsType::SegmentPoints);
642 break;
643 }
644 }
645 }
646 currentPlotPointsTypeAction = action;
647 m_mouseMode = mode;
648}
649
650void DatapickerImageView::changeZoom(QAction* action) {
651 if (action == zoomInViewAction)

Callers

nothing calls this directly

Calls 3

setSegmentsHoverEventMethod · 0.80
setPlotPointsTypeMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected