QMap遍历删除方法

QMap遍历删除

    QMap*>::iterator iter;
    QString key;
    for (iter = _curves.begin(); iter != _curves.end();)
    {
        //先存key
        key = iter.key();
        //指针移至下一个位置
        iter++;
        //删除当前位置数据
        QwtPlotCurve* curve = _curves.take(key);
        // Delete the object
        delete curve;
        // Set the pointer null
        curve = NULL;

        // Notify connected components about the removal
        emit curveRemoved(key);
    }

你可能感兴趣的:(QT,Qt)