0

I have main widget MainWindow, that contain my InfoWidget and InfoWidget has method mousePressEvent

void CustomWidget::mousePressEvent(QMouseEvent *event)
{
    QPoint p1 = QCursor::pos(); //I get global coordinates (570, 300);
    QPoint p1 = event->pos(); //I get (20, 50) - relative to my InfoWidget
}

my qt program

How can I get cursor position relatively to MainWindow (270, 200) ?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Dsgsfg
  • 11
  • 1

0 Answers0