Littlebitter
Littlebitter

Reputation: 701

Specify top-left corner position for QMenu

I have QPoint pos after clicking mouse and what to show at this point QMenu. But I what menu to appear that this pos will be left top corner of QMenu. And

menu.exec(pos);

shows menu such that pos is it's left edge middle point

Upvotes: 2

Views: 1205

Answers (1)

Leo Chapiro
Leo Chapiro

Reputation: 13979

Try to use mapToGlobal like this:

//menu.exec(pos);
menu.exec(mapToGlobal(pos));

Upvotes: 1

Related Questions