开发者

PyQt4 Qt Designer making dynamic GUIs

开发者 https://www.devze.com 2023-04-11 15:15 出处:网络
I\'m trying to figure out a way of using Qt Designer to make a dynamic GUI.For example, let\'s say I have a main window with a horizontal layout. I have a push button on one side and an empty area on

I'm trying to figure out a way of using Qt Designer to make a dynamic GUI. For example, let's say I have a main window with a horizontal layout. I have a push button on one side and an empty area on the other. When I click the button the empty area will be filled with a widget that I've made in Qt Designer. When the button is pressed again the widget will be replaced with another widget that I've made in Qt Designer. Woul开发者_高级运维d I have to go about making all my widgets, to fill the empty area, custom widgets?

I've tried setting the parent to the empty are, but on the second change I get this

QLayout: Attempting to add QLayout "" to QWidget "t2", which already has a layout

So then I tried deleting the layout but still see the old widget underneath the new one and the layout is now messed up.

help please


Never mind, figured it out. Simple really. Use QStackedWidget and as for the UIs made in Qt Designer wrap that in a class that inherits from QWidget.

0

精彩评论

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

关注公众号