Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved The program has unexpectedly finished

    General and Desktop
    qt5 charts
    3
    8
    570
    Loading More Posts
    • 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.
    • D
      deleted286 last edited by

      I add a button for clear series from my chart. So after series deleted, i can add new points on series.

      I have

        void Widget::on_clearChart_clicked()
      {
         chart->removeAllSeries();
      
      }
      

      But when i clicked button, and then, clicked my items on table widget for adding series, the program has unexpectedly finished.

      jsulm 1 Reply Last reply Reply Quote 0
      • jsulm
        jsulm Lifetime Qt Champion @deleted286 last edited by

        @suslucoder said in The program has unexpectedly finished:

        the program has unexpectedly finished

        First thing to do in such situation is to use debugger. So, please do so and see what exactly happens and where your app crashes.
        Is "chart" a valid pointer?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        D 1 Reply Last reply Reply Quote 0
        • D
          deleted286 @jsulm last edited by

          @jsulm yes it is valid.
          It clear the series.
          But after that, i cannot add new series.
          Should i write any connect?
          I did debug, it gives me the sıgnsev error

          jsulm 1 Reply Last reply Reply Quote 0
          • jsulm
            jsulm Lifetime Qt Champion @deleted286 last edited by

            @suslucoder said in The program has unexpectedly finished:

            I did debug, it gives me the sıgnsev error

            And how does the stack trace look like? Post it here.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            D 1 Reply Last reply Reply Quote 0
            • D
              deleted286 @jsulm last edited by

              @jsulm Screenshot from 2021-03-26 16-07-05.png
              Screenshot from 2021-03-26 16-06-19.png

              D 1 Reply Last reply Reply Quote 0
              • D
                deleted286 @deleted286 last edited by

                @suslucoder I did it like that it works without any problem but what is the difference between remove all series and remove them one by one

                chart->removeSeries(seri[0]);
                  chart->removeSeries(seri[1]);
                  chart->removeSeries(seri[2]);
                  chart->removeSeries(seri[3]);
                  chart->removeSeries(seri[4]);
                  chart->removeSeries(seri[5]);
                  chart->removeSeries(seri[6]);
                  chart->removeSeries(seri[7]);
                
                Pl45m4 1 Reply Last reply Reply Quote 0
                • Pl45m4
                  Pl45m4 @deleted286 last edited by Pl45m4

                  @suslucoder said in The program has unexpectedly finished:

                  what is the difference between remove all series and remove them one by one

                  void QChart::removeAllSeries()

                  Removes and deletes all series objects that have been added to the chart.
                  

                  (https://doc.qt.io/qt-5/qchart.html#removeAllSeries)

                  While

                  void QChart::removeSeries(QAbstractSeries *series)

                  Removes the series series from the chart. The chart releases the ownership of the specified series object.
                  

                  (https://doc.qt.io/qt-5/qchart.html#removeSeries)

                  I guess you are trying to double-delete the series pointers.


                  If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                  ~E. W. Dijkstra

                  D 1 Reply Last reply Reply Quote 2
                  • D
                    deleted286 @Pl45m4 last edited by

                    @Pl45m4 thank you

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post