QMap遍历删除方法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/asukasmallriver/article/details/78691088

QMap遍历删除

    QMap<QString, QwtPlotCurve*>::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);
    }

猜你喜欢

转载自blog.csdn.net/asukasmallriver/article/details/78691088