开发者

Casting a QDialog to QWidget

I lost my .ui file, and it seems pyuic4 cannot make a .ui file out of a .py file, only the other way around.

I have a QDialog, and I am now instead going to put its content开发者_如何学C inside a tab-pane. For that I need a widget, not a "stand-alone" dialog.

How can I cast QDialog to QWidget, or is there any other workaround other than doing the whole design over again.

Thanks


If I understand you correctly, you have a custom class that drives from QDialog, but you would now like to use it inside a tab pane rather than standalone.

For that the simplest path is to change your class to inherit from QWidget directly rather than QDialog. There should be little to no code change in that class (except for the obvious stuff in the constructor).

(I have no idea what your .ui problem has to do with this though.)

Also, QDialog inherits from QWidget. No type-casting necessary to use a QDialog when a QWidget is expected.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜