0

I'm trying to scale down an image so it will fit to my QGraphicsView, but keep it's original width and height, so when a mouse press event occours, I will get the correct coordinates in that image. Is that possible?

btw, in cv2, I can scale the width and height of the "imshow" window, and it will keep the right coordinates. I would hate to think that it is a hard task to do in Qt.

Thank you...

Omer
  • 456
  • 1
  • 3
  • 19
  • Possible duplicate of [PyQt:How do I display a image properly?](http://stackoverflow.com/questions/8687723/pyqthow-do-i-display-a-image-properly) – ekhumoro Nov 25 '15 at 17:44
  • @ekhumoro I can't use label, because I need to use QPainter on that image... – Omer Nov 25 '15 at 17:59
  • You can use the scaled pixmap in any way you like: the label is irrelevant. (And here's an alternative dup that uses `QImage`: [How do I resize an image and maintain its proportions?](http://stackoverflow.com/q/19715232/984421)) – ekhumoro Nov 25 '15 at 18:20
  • Let's say I have an image in dimensions 5120x3072. If I scale it down to 1024x614 and click on the bottom right corner of the image, the pos() method will return 1023, 613.. So the dimensions have changed... btw, I don't care about the AspectRatio. – Omer Nov 25 '15 at 19:43
  • Please correct me if I'm wrong, I'm kinda new with Qt – Omer Nov 25 '15 at 20:07
  • Never mind. I found my mistake. thank you – Omer Nov 25 '15 at 21:54

0 Answers0