Good Day,

I'm struggling with resizing my paint event!

In my constructor:
Qt Code:
  1. qLabel::qLabel(QWidget *parent) :
  2. QLabel(parent), windowSize(333, 494)
  3. {...
  4. QRect rect;
  5. rect.setTopLeft(QPoint(9, 9));
  6. rect.setSize(windowSize);
  7. setGeometry(rect);
  8. }
To copy to clipboard, switch view to plain text mode 

In my paint event
Qt Code:
  1. void mmetLabel::paintEvent(QPaintEvent *ev)
  2. {
  3. QLabel::paintEvent(ev);
  4. QPainter painter(this);
  5.  
  6. qreal sx = ev->rect().width() / (qreal)windowSize.width();
  7. qreal sy = ev->rect().height() / (qreal)windowSize.height();
  8. painter.scale(sx, sy);
  9. ...
  10. //draw points and lines between every 2 consective points
  11. }
To copy to clipboard, switch view to plain text mode 

Once I click on my label, I display the coordinates of the mouse ->working
Label also displays the 1st point and 2nd point coordinates -> working

My Paintevent -> NOT Working accordingly

It draws points not where mouse is clicked, hence the lines are completely not right
example, If I click at point1 (x=100, y=100) & click point2(x=152, y=251)
it draws a line from (x=230, y=128) -> (x=351, y=195) = completely wrong!

Please help
Kind Regards
Previous Thread(Title: Re: Paint event does not Rescale with label maximise)