Find the position of a module widget on the screen

Can someone point me at code or example that will help me find the current position of a ModuleWidget on the screen. In particular in relation to APP->scene->mousePos

I was able to figure it out:

screenPosition = moduleWidget->getRelativeOffset(relativePosition, APP->scene);

1 Like

Just curious… what was the reason you wanted to know the position on the screen?

I’m working on a sequencer with @joopvanderlinden. For the sequencer we are playing with a right click menu on each note that brings up a custom keyboard. The default right click menu moves to the mouse postion. We found this a little anoying as the keyboard position kept moving. So we wanted to make it where the right click menu would stay in a fixed position relative to module. To achieve that effect, I needes to figure where the module is on the screen and position the right click menu relative to that.

3 Likes