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.4k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on 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

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

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on 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
      0
      • jsulmJ jsulm

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

        R Offline
        R Offline
        Rameshwar
        wrote on 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.

        jsulmJ 1 Reply Last reply
        0
        • R Rameshwar

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

          jsulmJ Online
          jsulmJ Online
          jsulm
          Lifetime Qt Champion
          wrote on 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
          0
          • jsulmJ jsulm

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

            R Offline
            R Offline
            Rameshwar
            wrote on last edited by
            #10

            @jsulm

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

            jsulmJ 1 Reply Last reply
            0
            • R Rameshwar

              @jsulm

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

              jsulmJ Online
              jsulmJ Online
              jsulm
              Lifetime Qt Champion
              wrote on 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
              0
              • jsulmJ jsulm

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

                R Offline
                R Offline
                Rameshwar
                wrote on last edited by
                #12

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

                jsulmJ ODБOïO JonBJ 3 Replies Last reply
                -1
                • R Rameshwar

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

                  jsulmJ Online
                  jsulmJ Online
                  jsulm
                  Lifetime Qt Champion
                  wrote on 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

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

                    ODБOïO Offline
                    ODБOïO Offline
                    ODБOï
                    wrote on 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

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

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on 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

                      • Login

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