Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Qwt move marker with mouse between interpolated points
Forum Updated to NodeBB v4.3 + New Features

Qwt move marker with mouse between interpolated points

Scheduled Pinned Locked Moved 3rd Party Software
2 Posts 2 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Eligijus
    wrote on 1 Dec 2016, 11:18 last edited by
    #1

    Hello,

    Let's say i have curve with coordinates (x, y)(1, 1) (2, 1) (3, 1) and a marker. I want to get more x points for my marker to snap on when i move it with mouse. In other words i want my marker to snap to 1.1 , 1.2 , 1.3 x coordinates( now it only snaps to 1, 2 ,3).

    Code snippet of how i move my marker:

        marker->setLineStyle(QwtPlotMarker::VLine);
        marker->attach(tracePlot);
    
        picker = new QwtPlotPicker(tracePlot->xBottom, tracePlot->yLeft, QwtPicker::NoRubberBand,
    QwtPicker::AlwaysOff, tracePlot->canvas());
        pickerMachine = new QwtPickerDragPointMachine();
        picker->setStateMachine(pickerMachine);
    
    connect(picker, &QwtPicker::moved, this, &Widget::moveMarker);
    
    void Widget::moveMarker(QPoint actualMousePosition)
    {
        if(!flagZoom)
        {
            QwtText label;
            QString temp;
            int x = curve->closestPoint(actualMousePosition, NULL);
            QPointF position = curve->sample(x);
            marker->setValue(position);
            temp = QString::number(marker->xValue());
            label.setText(temp);
            marker->setLabel(label);
        }
        tracePlot->replot();
    }
    

    I figured i get limited by

    closestPoint(actualMousePosition, NULL);
    sample(x);
    

    returning ints but can't find any other solution.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 1 Dec 2016, 22:50 last edited by
      #2

      Hi,

      That's a question you should bring to the Qwt mailing list. Qwt's author is very active there.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2

      1/2

      1 Dec 2016, 11:18

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved