AnsweredAssumed Answered

Qt C   - How  Add Point to map with clicked mouse ? screenToLocation failed nan

Question asked by Juan_Carlos_Colchado on Sep 5, 2017
Latest reply on Sep 8, 2017 by Juan_Carlos_Colchado

my class Window_Map is the widget connect with mouse event and Slot my_clicked

 

void Window_Map::my_clicked(QMouseEvent &mouseEvent)
{


  if(mouseEvent.button()==Qt::LeftButton){
     auto mapPoint = _MapView->screenToLocation(mouseEvent.x(),mouseEvent.y());
     qDebug()<<" Punto :: "<<mapPoint;  // this show nan nan nan nan
  }
  else if(mouseEvent.button()==Qt::RightButton){
      _C.setShape(Qt::ArrowCursor);
      QGuiApplication::setOverrideCursor(_C);
      disconnect(_MapView,SIGNAL(mouseClicked(QMouseEvent&)),this,SLOT(s1(QMouseEvent&)));
  }
}

Outcomes