其他分享
首页 > 其他分享> > QCustomPlot使用经验

QCustomPlot使用经验

作者:互联网

一 QCPItemText文本的添加和删除

    QCPItemText *addText =new QCPItemText (textParent);//textParent为QCustomPlot对象
    addText->position->setCoords(pole.dist, updateRangY(textParent,pole.type));
    addText->setFont(QFont(font().family(), 10));    
    addText->setText(QTextCodec::codecForName("gbk")->toUnicode(pole.pole.toLatin1().data()));
    addText->setColor(txtColor);
    textParent->replot();
  for(int i=0;i<poleCurves.count();i++)
    {
        qDebug()<<"find del pole"<<i<<pole.dist<<poleCurves.at(i).first.dist<<pole.pole<<poleCurves.at(i).first.pole
               <<(abs(pole.dist-poleCurves.at(i).first.dist)<0.01)
              <<(pole.pole==poleCurves.at(i).first.pole);
        if((abs(pole.dist-poleCurves.at(i).first.dist)<0.01)&&poleCurves.at(i).first.pole.contains(pole.pole))
        {
            QPair<PoleInfo,QPair<curveInfo,curveInfo> > tmp=poleCurves.at(i);
            tmp.first.widthText->setText("");
            tmp.first.widthText->position->setCoords(0,0);
            tmp.first.heightText->setText("");
            tmp.first.heightText->position->setCoords(0,0);
            poleCurves.replace(i,tmp);
            pole=poleCurves.at(i).first;
            m_drawWireWidth->graph(poleCurves.at(i).second.first.curveIndex)->setVisible(false);
            m_drawWireHeight->graph(poleCurves.at(i).second.second.curveIndex)->setVisible(false);
            poleCurves.remove(i);
            qDebug()<<"del pole"<<i;
            delFlag=true;
            break;
        }
    }

二 曲线清除

graph(0)->data().data()->clear();
graph(0)->data().data()->clear()

  

 

标签:tmp,经验,data,addText,QCustomPlot,pole,使用,poleCurves,first
来源: https://www.cnblogs.com/gethope5/p/14956955.html