I have 2 GroupBoxes and I would like to get the current mouse position local to each GroupBox and globally .
That's What I want to achieve

check https://doc.qt.io/qt-5/qcursor.html#pos
QPoint QCursor::pos() Returns the position of the cursor (hot spot) of the primary screen in global screen coordinates.
You can call QWidget::mapFromGlobal() to translate it to widget coordinates.