Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to get data from URL/.php file and display in my fields
Forum Updated to NodeBB v4.3 + New Features

How to get data from URL/.php file and display in my fields

Scheduled Pinned Locked Moved Solved Mobile and Embedded
30 Posts 2 Posters 6.8k 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.
  • J jsulm
    16 Jan 2019, 05:38

    @Vineela

    object = array.at(1).toObject();
    QString code = object["LeaderCode"].toString();
    ui->comboBox_54->insertItem(3,code);
    //second
    qDebug()<< "InsertCode" +code;
    
    V Offline
    V Offline
    Vineela
    wrote on 16 Jan 2019, 05:40 last edited by
    #21

    @jsulm well I've added this
    for(int i=0 ;i<array.size();i++){
    QJsonObject object = array.at(i).toObject();
    } it worked

    1 Reply Last reply
    0
    • J jsulm
      16 Jan 2019, 05:38

      @Vineela

      object = array.at(1).toObject();
      QString code = object["LeaderCode"].toString();
      ui->comboBox_54->insertItem(3,code);
      //second
      qDebug()<< "InsertCode" +code;
      
      V Offline
      V Offline
      Vineela
      wrote on 16 Jan 2019, 05:41 last edited by
      #22

      @jsulm object = array.at(1).toObject();
      I've done this too but got only second one so.

      J 1 Reply Last reply 16 Jan 2019, 05:42
      0
      • V Vineela
        16 Jan 2019, 05:41

        @jsulm object = array.at(1).toObject();
        I've done this too but got only second one so.

        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 16 Jan 2019, 05:42 last edited by
        #23

        @Vineela said in How to get data from URL/.php file and display in my fields:

        I've done this too but got only second one so

        Yes, if you do this in a loop then you need to use index (i in your case) instead of fix numbers.

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

        V 2 Replies Last reply 16 Jan 2019, 05:44
        0
        • J jsulm
          16 Jan 2019, 05:42

          @Vineela said in How to get data from URL/.php file and display in my fields:

          I've done this too but got only second one so

          Yes, if you do this in a loop then you need to use index (i in your case) instead of fix numbers.

          V Offline
          V Offline
          Vineela
          wrote on 16 Jan 2019, 05:44 last edited by
          #24

          @jsulm well thank u so much for your help ,I've done it using for loop it worked.

          1 Reply Last reply
          1
          • J jsulm
            16 Jan 2019, 05:42

            @Vineela said in How to get data from URL/.php file and display in my fields:

            I've done this too but got only second one so

            Yes, if you do this in a loop then you need to use index (i in your case) instead of fix numbers.

            V Offline
            V Offline
            Vineela
            wrote on 16 Jan 2019, 07:05 last edited by
            #25

            @jsulm can u suggest here how to make it in ascending order???

            J 1 Reply Last reply 16 Jan 2019, 07:09
            0
            • V Vineela
              16 Jan 2019, 07:05

              @jsulm can u suggest here how to make it in ascending order???

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 16 Jan 2019, 07:09 last edited by
              #26

              @Vineela

              for(int i = array.size() - 1 ; i >= 0; --i) {
                  QJsonObject object = array.at(i).toObject();
              }
              

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

              V 2 Replies Last reply 16 Jan 2019, 07:15
              3
              • J jsulm
                16 Jan 2019, 07:09

                @Vineela

                for(int i = array.size() - 1 ; i >= 0; --i) {
                    QJsonObject object = array.at(i).toObject();
                }
                
                V Offline
                V Offline
                Vineela
                wrote on 16 Jan 2019, 07:15 last edited by
                #27

                @jsulm thanks you've saved my day :D it worked fine.

                1 Reply Last reply
                0
                • J jsulm
                  16 Jan 2019, 07:09

                  @Vineela

                  for(int i = array.size() - 1 ; i >= 0; --i) {
                      QJsonObject object = array.at(i).toObject();
                  }
                  
                  V Offline
                  V Offline
                  Vineela
                  wrote on 17 Jan 2019, 10:24 last edited by
                  #28

                  @jsulm my data is getting repeated once i come back is that bcoz of my for loop?

                  J 1 Reply Last reply 17 Jan 2019, 11:36
                  0
                  • V Vineela
                    17 Jan 2019, 10:24

                    @jsulm my data is getting repeated once i come back is that bcoz of my for loop?

                    J Offline
                    J Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 17 Jan 2019, 11:36 last edited by jsulm
                    #29

                    @Vineela Not sure what you mean?
                    You mean if you get new data and add new entries to your combo box you then have same values several times?
                    In this case you need to filter new values and only add values which are not yet in the box.

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

                    V 1 Reply Last reply 18 Jan 2019, 04:19
                    0
                    • J jsulm
                      17 Jan 2019, 11:36

                      @Vineela Not sure what you mean?
                      You mean if you get new data and add new entries to your combo box you then have same values several times?
                      In this case you need to filter new values and only add values which are not yet in the box.

                      V Offline
                      V Offline
                      Vineela
                      wrote on 18 Jan 2019, 04:19 last edited by
                      #30

                      @jsulm yes thnks i cleared the combo box before navigating to that page its ok now

                      1 Reply Last reply
                      0

                      21/30

                      16 Jan 2019, 05:40

                      • Login

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