首页 > 其他 > 详细

QHBoxLayout移除控件

时间:2018-06-17 00:05:43      阅读:798      评论:0      收藏:0      [点我收藏+]

 

def clear_layout(widget, layout):
        buttons = widget.findChildren(QtGui.QPushButton)
        while layout.itemAt(0) is not None:
            layout.removeItem(layout.itemAt(0))
        for i in buttons:
            i.setParent(None)

i.setParent(None)是必须的,如果只removeItem,则控件并不会消失

 

def clear_btn(widget, layout, object):
        for i in object:
            finish_btn = widget.findChild(QtGui.QPushButton, i)
            layout.removeWidget(finish_btn)
            finish_btn.setParent(None)

 

QHBoxLayout移除控件

原文:https://www.cnblogs.com/fuqia/p/9191765.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!