def METHOD_NAME(self, group, widget):
    """Sets the given widget as main widget for QGroupBox group."""
    # Removes every items from given layout.
    l = group.layout()
    while l.count():
        item = l.itemAt(0)
        l.removeItem(item)
        item.widget().deleteLater()
    l.addWidget(widget)
    widget.setParent(group)