Hello. I'm a begginer, then please don't scream at me I'm having problems with my simple application. mousePressEvent works fine (even in QgraphisView), but mouseRelaseEvent doesn't work in one. Please help. I'm using QT 4.4.3

This is part of my code:

Qt Code:
  1. BlackCat::BlackCat(QWidget *parent) : QWidget (parent)
  2. {
  3. (...)
  4. area1 = new QGraphicsScene;
  5. image1 = new QGraphicsView;
  6. image1->setFixedSize(200, 120);
  7. image1->setMouseTracking(true);
  8. image1->setInteractive (true);
  9. image1->setAcceptDrops(true);
  10. image1->setDragMode(QGraphicsView::NoDrag);
  11. (...)
  12. image1->setScene(area1);
  13. image1->show();
  14. (...)
  15. // x & y drag's position
  16. selectedx = new QLineEdit();
  17. selectedy = new QLineEdit();
  18.  
  19. // width & height drag's position
  20. selectedw = new QLineEdit();
  21. selectedh = new QLineEdit();
  22. (...)
  23. }
  24. (...)
  25.  
  26. void BlackCat::mousePressEvent(QMouseEvent *event)
  27. {
  28. QPoint pozycja = event->pos();
  29. QPoint posSceny = BlackCat::image1->mapFromScene(pozycja);
  30. int posx = posSceny.x();
  31. int posy = posSceny.y();
  32. QString num1, num2;
  33. num1.setNum(posx);
  34. num2.setNum(posy);
  35.  
  36. this->selectedx->setText(num1);
  37. this->selectedy->setText(num2);
  38.  
  39. }
  40.  
  41. void BlackCat::mouseReleaseEvent(QMouseEvent *event)
  42. {
  43. QPoint pozycja = event->pos();
  44. QPoint posSceny = BlackCat::image1->mapFromScene(pozycja);
  45. int posx = pozycja.x();
  46. int posy = pozycja.y();
  47. QString num1, num2;
  48. num1.setNum(posx);
  49. num2.setNum(posy);
  50.  
  51.  
  52. this->selectedw->setText(num1);
  53. this->selectedh->setText(num2);
  54. }
To copy to clipboard, switch view to plain text mode