PDA

View Full Version : Update QwtPlot after create the plot object...



jiapei100
1st February 2010, 13:53
I've got my own plot class CDataPlot


class CDataPlot : public QwtPlot
{
Q_OBJECT

public:
CDataPlot(QWidget* parent = 0);
virtual ~CDataPlot();
void SetPlotConfiguration(const QString& title = "", const QString& curvetitle="",
const QString& xtitle = "", const QString& ytitle = "",
double xlen = 0.0, double ylen = 0.0);
};


In the constructor

CDataPlot::CDataPlot(QWidget* parent):QwtPlot(parent)
{
setupQWTUi();
this->SetPlotConfiguration("This can !");
// I can update the title of the plot here. For sure, this is just the constructor of the plot !!!!
}

Then, I've got another class CObjectDetectionPlots



// Object detection figures
class CObjectDetectionPlots : public QMainWindow
{
Q_OBJECT

public:
CObjectDetectionPlots(QWidget *parent = 0, Qt::WFlags flags = 0);
~CObjectDetectionPlots();

CDataPlot* m_pDataPlot;
};



In the constructor


CObjectDetectionPlots::CObjectDetectionPlots(QWidg et *parent, Qt::WFlags flags)
: QMainWindow(parent, flags)
{
// private ui
m_pDataPlot = new CDataPlot(this);
m_pDataPlot->SetPlotConfiguration("Can the title be updated?"); // no updating at all !!!
m_pDataPlot->replot(); // even if replot(), no use!!!!
ui.setupUi(this);
}


I just want to update the title of CDataPlot* m_pDataPlot; after having created the plot. Can I?
If so, how to do it?


As you can see, if I updated the title from within plot's constructor, I can get it done.
However, if I try to update the plot's title from outside, no updating at all !!!!!!!!!
Even if I use replot(), no use at all!!!


Please can anybody help to explain and give me a solution how will QWT update the plot after a plot object has been created??


Best Regards
JIA

liversedge
1st February 2010, 15:13
You just need to call QwtPlot::setTitle?