我想问一个关于 qcustomplot 的问题。如何根据 Slider 更改 itemLine 位置?(如 x = a)
#include "itemline.h"
#include "ui_itemline.h"
#include "qcustomplot.h"
itemLine::itemLine(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::itemLine)
{
ui->setupUi(this);
QCPItemLine *item = new QCPItemLine(ui->customPlot);
ui->customPlot->addItem(item);
item->setPen(QPen(Qt::red));
item->start->setCoords(1,0);
item->end->setCoords(1,5);
connect(ui->horizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(horzSliderChanged(int)));
}
itemLine::~itemLine()
{
delete ui;
}
void itemLine::horzSliderChanged(int value)
{
// how can i change item position acording to horizontalSlider, like "x = a" line ?
}