[PySide] child widget cropped by parent's viewport

Frank Rueter | OHUfx frank at ohufx.com
Mon Jul 14 13:53:39 CEST 2014


Hi guys,

one of me typical issues:

I have a QMenu parented to the main app but it gets cropped by the 
parent widget's viewport (because it's button is right at the top of the 
widget).
I tried not parenting the menu and manually moving it instead via it's 
show() event using parent.mapTo(parent.pos()). But I can't get the 
correct positioning, the menu just shows up all over the shop no matter 
what combination of positions I try.

Another thought would be to adjust the size of the parent to accommodate 
for the menu (the parent widget is fully transparent), but that would 
trigger the paint event, which woudl re-position the buttons, and I 
would be chasing my tail.


There is no easier way to make a widget show outside of it's parent's 
widget's viewport than the first solution I mentioned, right?
In other words I just need to figure out how to get the correct screen 
position and manually move the menu.
Then I'm guessing I should call deleteLater() or something in it's 
parent's close event to ensure it gets garbage collected?


Am I on the right track here?

Cheers,
frank



More information about the PySide mailing list