Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QtCharts runtime crashing when I attempt to rescale X and Y axis?



  • I have a button that is supposed to scroll up and down the plot. I want to be able to rescale the axis when I do this, but my program keeps crashing at runtime when I click the button to scroll. My code is the following:

    chart->scroll(10,0);
    xMin += 10;
    xMax += 10;
    xAxis->setRange(xMin, xMax);
    chart->setAxisX(xAxis);

    My xAxis variable is of type QValueAxis and my xMin and xMax are both ints. My chart is type QChart.
    I am not sure what the error is since it crashes and doesn't display any error messages at compile time. Any help as to solving this issue would be much appreciated!



  • @engsml

    Probably the best to compile in debug and use the debugger of your tool chain. It shall tell you where the crash is happening. From there you can continue to investigate.

    Possibly one the pointers you are using is not properly initialized. That would be the first guess. Anything more detailed requires a crystal ball.



  • @koahnig Thank you! Yep it showed up as a segmentation fault in the debugger.


Log in to reply