how to get top level parent from the given widget?

How can given widget access it's oldest parent, which is top level widget.

I need to .showMinimized() it.

Now I am using

self.parent().parent().parent().showMinimized()

But it seem not to be the best way for this.
If it it moved, I need to change number of parent manually.

Is there a way to access top level widget?


如果您只是试图访问窗口小部件,则有QWidget.window()。

self.window().showMinimized()
链接地址: http://www.djcxy.com/p/77406.html

上一篇: 如何在PyQT的辅助显示器上显示一个窗口?

下一篇: 如何从给定的小部件获得顶级父级?