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. How to check an existance of a chart?
Forum Updated to NodeBB v4.3 + New Features

How to check an existance of a chart?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 370 Views 1 Watching
  • 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.
  • F Offline
    F Offline
    firsnur96
    wrote on last edited by
    #1

    How can i check the existance of chart_olstr[0] for removing the series.
    Because if chart_olstr[0] is not exist my app crash

          ```
          chart_olstr[0]->removeSeries(seri[i]);
          chart_olstr[0]->legend()->hide();
          chart_olstr[0]->update();
          seri[i]->clear();
    
    JonBJ 1 Reply Last reply
    0
    • F firsnur96

      How can i check the existance of chart_olstr[0] for removing the series.
      Because if chart_olstr[0] is not exist my app crash

            ```
            chart_olstr[0]->removeSeries(seri[i]);
            chart_olstr[0]->legend()->hide();
            chart_olstr[0]->update();
            seri[i]->clear();
      
      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @firsnur96 said in How to check an existance of a chart?:

      Because if chart_olstr[0] is not exist my app crash

      Is chart_olstr an array or list or whatever? So check its length/count or whether it is empty before attempting to address element #0 in it....

      F 1 Reply Last reply
      1
      • JonBJ JonB

        @firsnur96 said in How to check an existance of a chart?:

        Because if chart_olstr[0] is not exist my app crash

        Is chart_olstr an array or list or whatever? So check its length/count or whether it is empty before attempting to address element #0 in it....

        F Offline
        F Offline
        firsnur96
        wrote on last edited by
        #3

        @JonB yes it is an array.
        I cannot found any function like isEmpy, how should i check its lenght

        JonBJ Pl45m4P 2 Replies Last reply
        0
        • F firsnur96

          @JonB yes it is an array.
          I cannot found any function like isEmpy, how should i check its lenght

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @firsnur96
          Look at the documentation for whatever actual type you mean by "array".

          If it is a C-array, it won't have any varying length/count. But then you know its size/what elements you put in, or you are maintaining your own count variable.

          1 Reply Last reply
          1
          • F firsnur96

            @JonB yes it is an array.
            I cannot found any function like isEmpy, how should i check its lenght

            Pl45m4P Offline
            Pl45m4P Offline
            Pl45m4
            wrote on last edited by
            #5

            @firsnur96

            What kind of array? QVector? QList?
            What about chart_olstr.size()?

            Or just check element 0:
            chart_olstr[0] != nullptr


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

            ~E. W. Dijkstra

            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