i always get a runtime eror when i include this line in my code like that:

Qt Code:
  1. GAMainWindow::GAMainWindow(){
  2. QHBoxLayout* layout = new QHBoxLayout();
  3.  
  4. scene = new MapScene();
  5.  
  6. view = new MapView(scene, this);
  7. view->centerOn(1000, 1000);
  8. connect(view, SIGNAL(changeFullScreen()), this, SLOT(changeFullScreen()));
  9. connect(this, SIGNAL(mouseMovedOutOfView(QPoint)), view, SLOT(mouseMovedOutOfWindow(QPoint)));
  10. layout->addWidget(view);
  11. view->setMouseTracking(true);
  12. view->grabMouse();
  13.  
  14. panel = new MapPanel();
  15. layout->addWidget(panel);
  16.  
  17. connect(view, SIGNAL(mouseMoved(QPointF,QPointF)), panel, SLOT(newCoordinates(QPointF,QPointF)));
  18.  
  19. QWidget* widget = new QWidget();
  20. widget->setLayout(layout);
  21.  
  22. setCentralWidget(widget);
  23.  
  24. connect(scene, SIGNAL(sendData(int)), panel, SLOT(showID(int)));
  25. }
To copy to clipboard, switch view to plain text mode 

If I include the mouseGrap like this i get no Runtime error:

Qt Code:
  1. void MapView::keyPressEvent(QKeyEvent* event){
  2. switch (event->key()){
  3. case Qt::Key_B:
  4. this->grabMouse();
  5. break;
  6. }
  7. }
To copy to clipboard, switch view to plain text mode 

But now the MapView won't get any MouseMoveEvent. The MainWindow still gets them but here the track does not work. I i set MainWindow->setTrackingMouse(true) nothing is different.

It would work if my MainWindow AND my view would be able to track the mouse. Unfortunately they seem to be unable

Do you have any idea why I always get the runtime error when include grapMouse staticly?