QCustomPlot添加标题头

1 效果图

QCustomPlot添加标题头_第1张图片

2 代码
is2Label = QString("add title layout element");
    // add title layout element:
    ui->customplot->plotLayout()->insertRow(0);
    ui->customplot->plotLayout()->addElement(0, 0, new QCPTextElement(ui->customplot, xAxis2Label, QFont("sans", 10, QFont::Bold)));
    QCPTextElement *mQCPTextElement = new QCPTextElement(ui->customplot, "  右",QFont("sans", 9, QFont::Normal));
    mQCPTextElement->setTextFlags(Qt::AlignLeft);
    int c = ui->customplot->plotLayout()->elementCount();
    ui->customplot->plotLayout()->addElement(c, 0,mQCPTextElement );

 

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