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 display value in textEdit "only one at a time"
QtWS25 Last Chance

How to display value in textEdit "only one at a time"

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 4 Posters 1.3k Views
  • 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.
  • A Offline
    A Offline
    anuj nogja
    wrote on last edited by
    #1

    Hello all,
    I am reading interger value from a txt file and displaying it in textEdit. Program is reading the file line by line but displaying only the last values in textEdit.
    Requirement is to display the first value then wait for 1 seconds then second value from file should overwrite the earlier value and again wait for 1 second and so on...

    Kindly suggest the solution..
    Thanks in advance..
    Regards,
    Anuj

    aha_1980A T 2 Replies Last reply
    0
    • A anuj nogja

      Hello all,
      I am reading interger value from a txt file and displaying it in textEdit. Program is reading the file line by line but displaying only the last values in textEdit.
      Requirement is to display the first value then wait for 1 seconds then second value from file should overwrite the earlier value and again wait for 1 second and so on...

      Kindly suggest the solution..
      Thanks in advance..
      Regards,
      Anuj

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

      Hi, and welcome @anuj-nogja,

      You can use a QTimer with a timeout of 1 second to read the next line from the file and display it in the textEdit.

      Qt has to stay free or it will die.

      1 Reply Last reply
      3
      • A anuj nogja

        Hello all,
        I am reading interger value from a txt file and displaying it in textEdit. Program is reading the file line by line but displaying only the last values in textEdit.
        Requirement is to display the first value then wait for 1 seconds then second value from file should overwrite the earlier value and again wait for 1 second and so on...

        Kindly suggest the solution..
        Thanks in advance..
        Regards,
        Anuj

        T Offline
        T Offline
        Tirupathi Korla
        wrote on last edited by
        #3

        @anuj-nogja
        Use a timer with 1 sec and on timeout update textedit reading from file...

        1 Reply Last reply
        2
        • Paul ColbyP Offline
          Paul ColbyP Offline
          Paul Colby
          wrote on last edited by
          #4

          In addition to what @aha_1980 and @Tirupathi-Korla already said, if your 1-second requirement is based on assumptions about when the file is updated, you could consider using QFileSystemWatcher's fileChanged signal too.

          Cheers.

          T 1 Reply Last reply
          1
          • Paul ColbyP Paul Colby

            In addition to what @aha_1980 and @Tirupathi-Korla already said, if your 1-second requirement is based on assumptions about when the file is updated, you could consider using QFileSystemWatcher's fileChanged signal too.

            Cheers.

            T Offline
            T Offline
            Tirupathi Korla
            wrote on last edited by
            #5

            @Paul-Colby
            I don't think those are necessary.

            Paul ColbyP 1 Reply Last reply
            0
            • T Tirupathi Korla

              @Paul-Colby
              I don't think those are necessary.

              Paul ColbyP Offline
              Paul ColbyP Offline
              Paul Colby
              wrote on last edited by
              #6

              @Tirupathi-Korla, agreed. It's just that, depending on the use case, it can yield a better user experience, such as providing a significantly lower update latency. Just an option. As you say, not necessary.

              Cheers.

              A 1 Reply Last reply
              2
              • Paul ColbyP Paul Colby

                @Tirupathi-Korla, agreed. It's just that, depending on the use case, it can yield a better user experience, such as providing a significantly lower update latency. Just an option. As you say, not necessary.

                Cheers.

                A Offline
                A Offline
                anuj nogja
                wrote on last edited by
                #7

                @Paul-Colby thanks

                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