예제 #1
0
void AttributeEditor::clear()
{
    if (m_parent->layout())
    {
        clear_layout(m_parent->layout());
        delete m_parent->layout();
    }
}
예제 #2
0
void DisneyMaterialLayerUI::unfold()
{
    // Show the layer's content.
    m_content_widget->setVisible(true);

    // Hide the layer's name in the header.
    clear_layout(m_header_widget->layout());

    // Update the icon of the fold/unfold button.
    m_fold_unfold_button->setIcon(m_fold_icon);
}
예제 #3
0
void clear_layout(QLayout* layout)
{
    for (int i = layout->count(); i > 0; --i)
    {
        QLayoutItem* item = layout->takeAt(0);

        if (item->layout())
            clear_layout(item->layout());
        else item->widget()->deleteLater();

        delete item;
    }
}
예제 #4
0
// Completely clear out a layout.
// Use recursion to clear out layouts inside of layouts
void clear_layout(QLayout* layout)
{
    // Paranoia - Layout doesn't exist.
    if (!layout) return;

    while (QLayoutItem* item = layout->takeAt(0))
    {
        if (QWidget* widget = item->widget()) delete widget;

        if (QLayout* childLayout = item->layout())
        {
            clear_layout(childLayout);
        }
        delete item;
    }
}