Transient parent for QtWidgets popup menus

Elvis Angelaccio elvis.angelaccio at kde.org
Wed Jun 7 17:56:59 UTC 2017


On domenica 28 maggio 2017 10:37:40 CEST, Marco Martin wrote:
> On Sunday 28 May 2017 10:12:53 Elvis Angelaccio wrote:
>>    createWinId();
>> 
>> windowHandle()->setTransientParent(parent()->nativeParentWidget()->windowHan
>> dle());
>> 
>> Does it makes sense? Would it work?
>
> As far i know, if a qmenu is passed a parent in the ctor, then at the right 
> moment a transientparent is set as well, that's why most of menus are ok.
>
> for a general solution,  tried to do this in Qt:
> https://codereview.qt-project.org/#/c/195704/

Any idea about drop menus? (i.e. QMenus usually created in some dropEvent() 
function). Even if they have a parent, they are positioned in the place the 
drag started, rather than the place where the drop happened. It seems that 
QCursor::pos() (passed to QMenu::exec()) is broken if called inside 
dropEvent(), almost like if the app does not realize that the mouse cursor 
moved?






More information about the Plasma-devel mailing list