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. problem with scope of array??
Qt 6.11 is out! See what's new in the release blog

problem with scope of array??

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 5 Posters 3.0k 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.
  • TheCipo76T Offline
    TheCipo76T Offline
    TheCipo76
    wrote on last edited by TheCipo76
    #3

    the arrays was created with code on form load

    ui->setupUi(this);
    
    ... create arrays and add it to general layout
    

    when i lauch application and click on pushbutton (slot / event)

    don't find the array (added as you see in the gridLayout)

    and give me the up-posted error..

    can i solve with associated variables? and how i have to do in this case?

    JonBJ 1 Reply Last reply
    0
    • TheCipo76T TheCipo76

      the arrays was created with code on form load

      ui->setupUi(this);
      
      ... create arrays and add it to general layout
      

      when i lauch application and click on pushbutton (slot / event)

      don't find the array (added as you see in the gridLayout)

      and give me the up-posted error..

      can i solve with associated variables? and how i have to do in this case?

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

      @TheCipo76
      Probably then make the array variable be a member of your "form", then it will stay in scope.

      TheCipo76T 1 Reply Last reply
      0
      • JonBJ JonB

        @TheCipo76
        Probably then make the array variable be a member of your "form", then it will stay in scope.

        TheCipo76T Offline
        TheCipo76T Offline
        TheCipo76
        wrote on last edited by
        #5

        @JonB i have no idea how to do it..

        can you put here an exampe please?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #6

          Hi,

          Best to read about them here.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          TheCipo76T JonBJ 2 Replies Last reply
          2
          • SGaistS SGaist

            Hi,

            Best to read about them here.

            TheCipo76T Offline
            TheCipo76T Offline
            TheCipo76
            wrote on last edited by
            #7

            @SGaist
            Ok, now i've understand how to do it.
            Thank you very much

            1 Reply Last reply
            1
            • SGaistS SGaist

              Hi,

              Best to read about them here.

              JonBJ Online
              JonBJ Online
              JonB
              wrote on last edited by
              #8

              @SGaist said in problem with scope of array??:

              Hi,

              Best to read about them here.

              How come you give him one dense reference to read and it turns out to be just the right one to explain to his satisfaction?!

              aha_1980A 1 Reply Last reply
              0
              • JonBJ JonB

                @SGaist said in problem with scope of array??:

                Hi,

                Best to read about them here.

                How come you give him one dense reference to read and it turns out to be just the right one to explain to his satisfaction?!

                aha_1980A Offline
                aha_1980A Offline
                aha_1980
                Lifetime Qt Champion
                wrote on last edited by
                #9

                @JonB ... it was the right reference ;)

                Qt has to stay free or it will die.

                1 Reply Last reply
                1
                • TheCipo76T Offline
                  TheCipo76T Offline
                  TheCipo76
                  wrote on last edited by
                  #10

                  Ok i read the link documentation but i can't do this work..

                  i think that i have to create a class with QLabelEdit array

                  so i can manage data in or out the main with no scope problem.

                  It is correct?

                  If yes..

                  i've view some tutorial in order to learn c++ ( i'm coming from VB6)
                  but this is too complicate for me..

                  anyone can put a example?

                  jsulmJ 1 Reply Last reply
                  0
                  • TheCipo76T TheCipo76

                    Ok i read the link documentation but i can't do this work..

                    i think that i have to create a class with QLabelEdit array

                    so i can manage data in or out the main with no scope problem.

                    It is correct?

                    If yes..

                    i've view some tutorial in order to learn c++ ( i'm coming from VB6)
                    but this is too complicate for me..

                    anyone can put a example?

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

                    @TheCipo76 Simply put these arrays as member variables of your form class, there is no need for an extra class just for these arrays.

                    class regtemciclo: public...
                    {
                    ...
                    private:
                        QLineEdit *array_Fine15[5];
                    ...
                    }
                    

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

                    TheCipo76T 1 Reply Last reply
                    1
                    • jsulmJ jsulm

                      @TheCipo76 Simply put these arrays as member variables of your form class, there is no need for an extra class just for these arrays.

                      class regtemciclo: public...
                      {
                      ...
                      private:
                          QLineEdit *array_Fine15[5];
                      ...
                      }
                      
                      TheCipo76T Offline
                      TheCipo76T Offline
                      TheCipo76
                      wrote on last edited by
                      #12

                      @jsulm Eureka! it works..

                      thank you very much!

                      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