Qwt graph page crashes GUI
-
As noted setSymbol causes the program to crash
-
As noted setSymbol causes the program to crash
-
While playing with the code I discovered that if i comment out the lines:
grid->setMajorPen(Qt::gray,1,Qt::Dashline);
grid->setMinorPen(Qt::gray,1,Qt::Dashline);
curve1->setPen(colour1);
curve1->setSymbol(symbol1)grid is a QwtPlotGrid and curve1 is a QwtPlotCurve.
Then the code works. However i still need to change how the curve looks.
@MShields said:
curve1->setSymbol(symbol1)
As shown in previous post, the last of the four commented out lines
-
Full code is
QwtSymbol *symbola1 = new QwtSymbol( QwtSymbol::Ellipse, QBrush( Qt::black ), QPen( Qt::red, 2 ), QSize( 8, 8 ) );
curve1->setSymbol( symbola1 ); -
To be clear it will crash when all four of these lines are commented out. The program will crash if any one of the four are uncommented.
-
Here is the all the lines as is:
// grid->setMajorPen(Qt::gray, 1, Qt::DashLine);
// grid->setMinorPen(Qt::gray, 1, Qt::DashLine);QColor colour1 = Qt::red;
// curve1->setPen(colour1);
QwtSymbol *symbola1 = new QwtSymbol( QwtSymbol::Ellipse, QBrush( Qt::black ), QPen( Qt::red, 2 ), QSize( 8, 8 ) );
// curve1->setSymbol( symbola1 );If any of the lines which are commented out are uncommented out the the program crashs when it reachs that page.
-
grid and curve1 are successfully used in other situations
e.g
grid->enableX(true);
grid->attach(myPlot);curve1->setSamples(Column1, Column2, 26);
curve1->setYAxis(QwtPlot::yLeft); -
grid and curve1 are successfully used in other situations
e.g
grid->enableX(true);
grid->attach(myPlot);curve1->setSamples(Column1, Column2, 26);
curve1->setYAxis(QwtPlot::yLeft);@MShields said:
grid and curve1 are successfully used in other situations
e.g
grid->enableX(true);
grid->attach(myPlot);curve1->setSamples(Column1, Column2, 26);
curve1->setYAxis(QwtPlot::yLeft);That might be, but the question is if they are still valid when you are trying to access where you the crash. E.g. try to modify curve1 with setSymbol when you are able to use those pointers successfully.
For instance this way:
curve1->setSamples(Column1, Column2, 26); curve1->setYAxis(QwtPlot::yLeft); QColor colour1 = Qt::red; curve1->setPen(colour1); QwtSymbol *symbola1 = new QwtSymbol( QwtSymbol::Ellipse, QBrush( Qt::black ), QPen( Qt::red, 2 ), QSize( 8, 8 ) ); curve1->setSymbol( symbola1 ); -
That is how it is suppose to work, curve1 has setSamples, setYAxis, etc set up.
The problem is when setPen or setSymbol are added in. I have had to comment them out to prevent the program from crashing.