It seems like I do something basic wrong.
I have a Window MonitorPlotWindow in its constructor i call
MonitorPlotWindow
::MonitorPlotWindow(QWidget *parent
) : ui(new Ui::MonitorPlotWindow)
{
ui->setupUi(this);
SetupPlot();
}
MonitorPlotWindow::MonitorPlotWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MonitorPlotWindow)
{
ui->setupUi(this);
SetupPlot();
}
To copy to clipboard, switch view to plain text mode
SetupPlot looks like this.
void MonitorPlotWindow::SetupPlot(){
livePlot
= new QwtPlot(ui
->centralwidget
);
ui->horizontalLayout->addWidget(livePlot);
liveGrid->attach(livePlot);
livePlot->setCanvasBackground(Qt::white);
legend
->setFrameStyle
(QFrame::Box|QFrame
::Sunken);
livePlot
->insertLegend
(legend,
QwtPlot::BottomLegend);
livePlot
->detachItems
(QwtPlotItem::Rtti_PlotLegend,
true);
}
void MonitorPlotWindow::SetupPlot(){
livePlot = new QwtPlot(ui->centralwidget);
ui->horizontalLayout->addWidget(livePlot);
QwtPlotGrid *liveGrid = new QwtPlotGrid();
liveGrid->attach(livePlot);
QwtPlotPanner *plotPanner = new QwtPlotPanner(livePlot->canvas());
QwtPlotMagnifier *plotMagnifier = new QwtPlotMagnifier(livePlot->canvas());
livePlot->setCanvasBackground(Qt::white);
QwtLegend *legend = new QwtLegend;
legend->setFrameStyle(QFrame::Box|QFrame::Sunken);
livePlot->insertLegend(legend, QwtPlot::BottomLegend);
livePlot->detachItems(QwtPlotItem::Rtti_PlotLegend, true);
}
To copy to clipboard, switch view to plain text mode
From another Window I call
void MonitorWindow::on_actionShow_triggered(){
Plot->show();
}
void MonitorWindow::on_actionShow_triggered(){
Plot->show();
}
To copy to clipboard, switch view to plain text mode
void MonitorWindow::allocateMemory(){
Plot = new MonitorPlotWindow(this);
}
void MonitorWindow::allocateMemory(){
Plot = new MonitorPlotWindow(this);
}
To copy to clipboard, switch view to plain text mode
Bookmarks