I've got my own plot class CDataPlot
{
Q_OBJECT
public:
virtual ~CDataPlot();
void SetPlotConfiguration(const QString& title = "", const QString& curvetitle="",
const QString& xtitle = "", const QString& ytitle = "",
double xlen = 0.0, double ylen = 0.0);
};
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);
};
To copy to clipboard, switch view to plain text mode
In the constructor
{
setupQWTUi();
this->SetPlotConfiguration("This can !");
// I can update the title of the plot here. For sure, this is just the constructor of the plot !!!!
}
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 !!!!
}
To copy to clipboard, switch view to plain text mode
Then, I've got another class CObjectDetectionPlots
// Object detection figures
{
Q_OBJECT
public:
CObjectDetectionPlots
(QWidget *parent
= 0, Qt
::WFlags flags
= 0);
~CObjectDetectionPlots();
CDataPlot* m_pDataPlot;
};
// Object detection figures
class CObjectDetectionPlots : public QMainWindow
{
Q_OBJECT
public:
CObjectDetectionPlots(QWidget *parent = 0, Qt::WFlags flags = 0);
~CObjectDetectionPlots();
CDataPlot* m_pDataPlot;
};
To copy to clipboard, switch view to plain text mode
In the constructor
CObjectDetectionPlots
::CObjectDetectionPlots(QWidget *parent, Qt
::WFlags 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);
}
CObjectDetectionPlots::CObjectDetectionPlots(QWidget *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);
}
To copy to clipboard, switch view to plain text mode
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
Bookmarks