QT 遍历 删除 QMap

    QMap::iterator iter = m_pages.begin();
    while (iter != m_pages.end()){
        if (presistMenuIds.contains(iter.key())) {
            iter++;
            continue;
        }

        int key = iter.key();

        iter++;

        QWidget *widget = m_pages.take(key);
        delete widget;
        widget = nullptr;
    }

 

你可能感兴趣的:(QT,C++,QMap,遍历,删除)