[英]Specify top-left corner position for QMenu
I have QPoint pos after clicking mouse and what to show at this point QMenu. 单击鼠标后,我将显示QPoint pos以及此时要显示的QMenu。 But I what menu to appear that this pos will be left top corner of QMenu.
但是我该pos将出现在QMenu的左上角的菜单上。 And
和
menu.exec(pos);
shows menu such that pos is it's left edge middle point 显示菜单,使得pos是它的左边缘中间点
Try to use mapToGlobal like this: 尝试像这样使用mapToGlobal :
//menu.exec(pos);
menu.exec(mapToGlobal(pos));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.