void UIWidget::destroyChildren() { UILayoutPtr layout = getLayout(); if(layout) layout->disableUpdates(); m_focusedChild = nullptr; m_lockedChildren.clear(); while(!m_children.empty()) { UIWidgetPtr child = m_children.front(); m_children.pop_front(); child->setParent(nullptr); m_layout->removeWidget(child); child->destroy(); } layout->enableUpdates(); }