Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. QwtPlot Not able to update(replot) in QMainWindow
Forum Update on Monday, May 27th 2025

QwtPlot Not able to update(replot) in QMainWindow

Scheduled Pinned Locked Moved 3rd Party Software
4 Posts 2 Posters 5.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    webmaster.skelton
    wrote on 2 Mar 2011, 19:39 last edited by
    #1

    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

    1 Reply Last reply
    0
    • W Offline
      W Offline
      webmaster.skelton
      wrote on 3 Mar 2011, 14:32 last edited by
      #2

      no one wants to touch this one huh? lol

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goetz
        wrote on 3 Mar 2011, 14:47 last edited by
        #3

        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....

        http://www.catb.org/~esr/faqs/smart-questions.html

        1 Reply Last reply
        0
        • W Offline
          W Offline
          webmaster.skelton
          wrote on 3 Mar 2011, 15:16 last edited by
          #4

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

          1 Reply Last reply
          0

          1/4

          2 Mar 2011, 19:39

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved