Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Hi, I am new for Qt, i am trying to display 0 to 999 in text Browser but when i am executing following code it is directly showing 999 output can anyone help me, thank you in advance
Forum Updated to NodeBB v4.3 + New Features

Hi, I am new for Qt, i am trying to display 0 to 999 in text Browser but when i am executing following code it is directly showing 999 output can anyone help me, thank you in advance

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
qtcreatorproblempogram
15 Posts 6 Posters 3.0k Views 2 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.
  • S Offline
    S Offline
    SGaist
    Lifetime Qt Champion
    wrote on 18 Mar 2019, 20:33 last edited by
    #6

    Hi,

    How is it not useful ? The QTimer approach is the right one if you want to display a progressive counter in a way that your application user can see it.

    Using a loop like you do just blocks the event loop. That's why you only see the widget content after the loop ended.

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

    1 Reply Last reply
    2
    • R Rameshwar
      18 Mar 2019, 12:17

      @J.Hilk
      but this type not usefull on ui(user interface) window, i want to display this data on mainwindow.ui.

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 19 Mar 2019, 08:37 last edited by
      #7

      @Rameshwar If you need this code inside mainwindow then put it there, it isn't that hard.

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

      R 1 Reply Last reply 19 Mar 2019, 08:55
      0
      • J jsulm
        19 Mar 2019, 08:37

        @Rameshwar If you need this code inside mainwindow then put it there, it isn't that hard.

        R Offline
        R Offline
        Rameshwar
        wrote on 19 Mar 2019, 08:55 last edited by
        #8

        @jsulm
        but if you write code inside mainwindow then , it does not display step by step directly it displays last value that is 999 or using append it displays 0,1,2.....999 once time but i want it displays step by step first it display "1" then increment (i++) then it display "2" then and again it (i++) increment by one and display 3....999.

        J 1 Reply Last reply 19 Mar 2019, 08:56
        0
        • R Rameshwar
          19 Mar 2019, 08:55

          @jsulm
          but if you write code inside mainwindow then , it does not display step by step directly it displays last value that is 999 or using append it displays 0,1,2.....999 once time but i want it displays step by step first it display "1" then increment (i++) then it display "2" then and again it (i++) increment by one and display 3....999.

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 19 Mar 2019, 08:56 last edited by
          #9

          @Rameshwar Then you're doing it wrong. Please show your code.

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

          R 1 Reply Last reply 19 Mar 2019, 09:05
          0
          • J jsulm
            19 Mar 2019, 08:56

            @Rameshwar Then you're doing it wrong. Please show your code.

            R Offline
            R Offline
            Rameshwar
            wrote on 19 Mar 2019, 09:05 last edited by
            #10

            @jsulm

            for(j=0;j<1000;j++)
            // {
            ui->textBrowser->setText(QString::number(j)); //display 0 to 999
            // }
            //your code here

            J 1 Reply Last reply 19 Mar 2019, 09:09
            0
            • R Rameshwar
              19 Mar 2019, 09:05

              @jsulm

              for(j=0;j<1000;j++)
              // {
              ui->textBrowser->setText(QString::number(j)); //display 0 to 999
              // }
              //your code here

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 19 Mar 2019, 09:09 last edited by
              #11

              @Rameshwar This code is NOT what @J-Hilk suggested...

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

              R 1 Reply Last reply 19 Mar 2019, 09:15
              0
              • J jsulm
                19 Mar 2019, 09:09

                @Rameshwar This code is NOT what @J-Hilk suggested...

                R Offline
                R Offline
                Rameshwar
                wrote on 19 Mar 2019, 09:15 last edited by
                #12

                @jsulm i want to display contineousaly some data after one second on window.ui

                J O J 3 Replies Last reply 19 Mar 2019, 09:22
                -1
                • R Rameshwar
                  19 Mar 2019, 09:15

                  @jsulm i want to display contineousaly some data after one second on window.ui

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 19 Mar 2019, 09:22 last edited by
                  #13

                  @Rameshwar This is exactly what was already suggested (using QTimer). Did you try?!

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

                  1 Reply Last reply
                  0
                  • R Rameshwar
                    19 Mar 2019, 09:15

                    @jsulm i want to display contineousaly some data after one second on window.ui

                    O Offline
                    O Offline
                    ODБOï
                    wrote on 19 Mar 2019, 09:25 last edited by
                    #14

                    @Rameshwar said in Hi, I am new for Qt, i am trying to display 0 to 999 in text Browser but when i am executing following code it is directly showing 999 output can anyone help me, thank you in advance:

                    i want to display contineousaly some data after one second on window.ui

                    everyone here understood your requirement! Solutions are suggested ! why don't you try instead of repeating the same thing over &over ?

                    1 Reply Last reply
                    2
                    • R Rameshwar
                      19 Mar 2019, 09:15

                      @jsulm i want to display contineousaly some data after one second on window.ui

                      J Offline
                      J Offline
                      JonB
                      wrote on 19 Mar 2019, 10:05 last edited by
                      #15

                      @Rameshwar

                      • @J-Hilk has given you the necessary code to start from. That's why people type in answers to questions. First try that and verify it works.

                      • Then change it so that it writes on your mainwindow or whatever you want instead.

                      • Only after that, write back if you can't get what you want working.

                      1 Reply Last reply
                      2

                      15/15

                      19 Mar 2019, 10:05

                      • Login

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