QwtPlot Not able to update(replot) in QMainWindow



  • I have recently started utilizing Qwt, as it seemed a suitable solution. I am sub classing QwtPlot to create my own graph class. Everything was going well until i tried to actually plot to a QMainWindow. For some reason whenever i call replot() no update occurs. At first I thought it was losing reference to my QwtPlotCurve but i have since tested that. So now I am not sure what to do. I even tried reimplementing the replot() method to see if i could force a redraw of the points. If i do the same process that i am in the main.cpp everything works just fine. So why is QMainWindow preventing the update of my QwtPlot widget? Any direction would be greatly appreciated.

    Here is the function in which i am setting the RawSamples to the QwtPlotCurve
    @ void LineGraph::setCurveData(double xData[], double yData[],int setPlotMargine)
    {

     cCurve = new QwtPlotCurve();
     cCurve->setRawSamples(xData,yData,setPlotMargine);
    
     cCurve->attach(this);
    

    }@

    and here is where i am trying to set it to a frame in MainWindow

    @MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);

    LineGraph *plot = new LineGraph();
    
    plot->setYLeftAxisTitle(QString("hello"));
    
    double x = 100.0;
    double px = 0.0;
    
    double y = 0.0;
    double py = 100.0;
    
    plot->setYLeftAxisLength(y,py);
    plot->setXBottomAxisLength(px,x);
    
    double x1[50];
    double y1[50];
    
    for(int i =0; i<50; i++)
    {
    
    
        x1[i] = i * 6;
        y1[i] = i*6;
    
    }
    
    plot->setGridToLineGraph(true);
    
    plot->setCurveData(x1,y1,5);
    
    
    
    plot->replot();
    QGridLayout *layout = new QGridLayout;
    
    layout->addWidget(plot);
    ui->frame->setLayout(layout);
    

    }
    @

    Thanks



  • no one wants to touch this one huh? lol



  • Come on! Not even 24 hours and you're crying? It's not always the case that someone comes back with a solution within 30 minutes....



  • lol i know, i know. I get impatient sometimes, i apologize.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.