Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. The program has unexpectedly finished

The program has unexpectedly finished

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt5charts
8 Posts 3 Posters 1.1k 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.
  • D Offline
    D Offline
    deleted286
    wrote on last edited by
    #1

    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.

    jsulmJ 1 Reply Last reply
    0
    • D deleted286

      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.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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
      0
      • jsulmJ jsulm

        @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?

        D Offline
        D Offline
        deleted286
        wrote on last edited by
        #3

        @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

        jsulmJ 1 Reply Last reply
        0
        • D deleted286

          @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

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @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
          0
          • jsulmJ jsulm

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

            D Offline
            D Offline
            deleted286
            wrote on last edited by
            #5

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

            D 1 Reply Last reply
            0
            • D deleted286

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

              D Offline
              D Offline
              deleted286
              wrote on last edited by
              #6

              @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]);
              
              Pl45m4P 1 Reply Last reply
              0
              • D deleted286

                @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]);
                
                Pl45m4P Offline
                Pl45m4P Offline
                Pl45m4
                wrote on last edited by Pl45m4
                #7

                @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
                2
                • Pl45m4P 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.

                  D Offline
                  D Offline
                  deleted286
                  wrote on last edited by
                  #8

                  @Pl45m4 thank you

                  1 Reply Last reply
                  0

                  • Login

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