1. Compile and run the attached standalone program against Qt 5.12.3.
2. Click on the QToolButton
3. Observe that the popup menu is aligned with the QToolButton
4. Compile and run the attached standalone program against Qt 6.2.4.
5. Click on the QToolButton
6. BUG: Observe that the popup menu is not aligned with the QToolButton, it is even out of the QMainWindow.
In the attached source code, you can also pass the command line argument "-w" to have the QFrame as the central widget directly instead of the QGraphicsView. In this case, there is no bug with either 5.12.3 or 6.2.4.
I tested on mac and Windows. It might be an issue on Linux too.
Note that looks similar too an old fixed bug in Qt4: