Hi. I have a problem with window-viewport coordinates. In my code I draw a polygon:

Qt Code:
  1. static const int upPoints_p[4][2] = {
  2. { 49, -49 }, { -49, -49 },
  3. { -10, -10 }, { 10, -10 }
  4. };
  5.  
  6. QPolygon up_p(4, &upPoints_p[0][0]);
  7. painter.setWindow( -50, -50, 100, 100);
  8. painter.drawPolygon(up_p);
To copy to clipboard, switch view to plain text mode 


and next, I would like to check mousePressEvent:

Qt Code:
  1. QPoint point = event->pos();
  2. if( up_p.containsPoint(point, Qt::OddEvenFill) )
  3. {
  4.  
  5. }
To copy to clipboard, switch view to plain text mode 

but I have different coordinate. Can someone help me fix my code?