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 recent Logs and can be filter according to the checkboxes?

How to Display recent Logs and can be filter according to the checkboxes?

Scheduled Pinned Locked Moved Unsolved General and Desktop
13 Posts 2 Posters 2.1k 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.
  • jsulmJ jsulm

    @Aviral-0 What logs do you mean? From where do they come?
    Logs are simple text, so you can use https://doc.qt.io/qt-6/qtextbrowser.html for example.
    But if you also want to filter the logs you should go for https://doc.qt.io/qt-5/model-view-programming.html

    Aviral 0A Offline
    Aviral 0A Offline
    Aviral 0
    wrote on last edited by
    #3

    @jsulm Hi, Thankyou for replying. If you can find any prebuild code for this, then please share! Thanks a lot!

    jsulmJ 1 Reply Last reply
    0
    • Aviral 0A Aviral 0

      @jsulm Hi, Thankyou for replying. If you can find any prebuild code for this, then please share! Thanks a lot!

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

      @Aviral-0 You did not answer any of my questions and ask me to find prebuild code for you?!

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

      Aviral 0A 1 Reply Last reply
      1
      • jsulmJ jsulm

        @Aviral-0 You did not answer any of my questions and ask me to find prebuild code for you?!

        Aviral 0A Offline
        Aviral 0A Offline
        Aviral 0
        wrote on last edited by
        #5

        @jsulm I think I need to build QProcess to show tail command output of a log file on QTextEdit Window.
        Can you give me some refernce plz

        jsulmJ 1 Reply Last reply
        0
        • Aviral 0A Aviral 0

          @jsulm I think I need to build QProcess to show tail command output of a log file on QTextEdit Window.
          Can you give me some refernce plz

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

          @Aviral-0 I don't know what you mean. If you want to read data at the end of a file why do you need to start a process for that at all?! Why don't you simply use QFile, seek to a position from where you want to read and then read?
          If you want to use tail command with QProcess then please try first by yourself and ask if it does not work. There are many examples how to use QProcess. You will need to read stdout of the process to get the output from that process (https://doc.qt.io/qt-6/qprocess.html#finished + https://doc.qt.io/qt-6/qprocess.html#readAllStandardOutput).

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

          Aviral 0A 1 Reply Last reply
          1
          • jsulmJ jsulm

            @Aviral-0 I don't know what you mean. If you want to read data at the end of a file why do you need to start a process for that at all?! Why don't you simply use QFile, seek to a position from where you want to read and then read?
            If you want to use tail command with QProcess then please try first by yourself and ask if it does not work. There are many examples how to use QProcess. You will need to read stdout of the process to get the output from that process (https://doc.qt.io/qt-6/qprocess.html#finished + https://doc.qt.io/qt-6/qprocess.html#readAllStandardOutput).

            Aviral 0A Offline
            Aviral 0A Offline
            Aviral 0
            wrote on last edited by
            #7

            @jsulm Okay, Let me tell you what I really want to create.
            I want to create a Log display window which updates logs in real time and user be able to select or copy the displayed logs from that window.
            Simple example is like in the below image
            Screenshot 2023-02-03 112738.png
            As you can see the logs shown in below window.
            I am still confused if these logs should be read via any file or any function is there which directly displays these logs to any widgets.
            Please Help!

            jsulmJ 1 Reply Last reply
            0
            • Aviral 0A Aviral 0

              @jsulm Okay, Let me tell you what I really want to create.
              I want to create a Log display window which updates logs in real time and user be able to select or copy the displayed logs from that window.
              Simple example is like in the below image
              Screenshot 2023-02-03 112738.png
              As you can see the logs shown in below window.
              I am still confused if these logs should be read via any file or any function is there which directly displays these logs to any widgets.
              Please Help!

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

              @Aviral-0 said in How to Display recent Logs and can be filter according to the checkboxes?:

              I am still confused if these logs should be read via any file or any function is there which directly displays these logs to any widgets

              As far as I can see you did NOT explain from where these logs are comming. I already asked you what logs those are, but you did not answer this question. So, how should I know what you should use if you refuse to answer that simple question?

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

              Aviral 0A 1 Reply Last reply
              0
              • jsulmJ jsulm

                @Aviral-0 said in How to Display recent Logs and can be filter according to the checkboxes?:

                I am still confused if these logs should be read via any file or any function is there which directly displays these logs to any widgets

                As far as I can see you did NOT explain from where these logs are comming. I already asked you what logs those are, but you did not answer this question. So, how should I know what you should use if you refuse to answer that simple question?

                Aviral 0A Offline
                Aviral 0A Offline
                Aviral 0
                wrote on last edited by
                #9

                @jsulm These logs are the updates of ongoing process in application. It will be already available for me I guess. In a form of file i think

                jsulmJ 1 Reply Last reply
                0
                • Aviral 0A Aviral 0

                  @jsulm These logs are the updates of ongoing process in application. It will be already available for me I guess. In a form of file i think

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

                  @Aviral-0 said in How to Display recent Logs and can be filter according to the checkboxes?:

                  In a form of file i think

                  You think?!
                  Before you continue you should find out how these logs are generated. If you think it is a file: where is it located and what is its name? If you don't know that how do you want to read the logs?!
                  Programming should not be based on guessing...

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

                  Aviral 0A 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @Aviral-0 said in How to Display recent Logs and can be filter according to the checkboxes?:

                    In a form of file i think

                    You think?!
                    Before you continue you should find out how these logs are generated. If you think it is a file: where is it located and what is its name? If you don't know that how do you want to read the logs?!
                    Programming should not be based on guessing...

                    Aviral 0A Offline
                    Aviral 0A Offline
                    Aviral 0
                    wrote on last edited by
                    #11

                    @jsulm Okay, So I would be getting a log file which will be getting updated rapidly.

                    jsulmJ 1 Reply Last reply
                    0
                    • Aviral 0A Aviral 0

                      @jsulm Okay, So I would be getting a log file which will be getting updated rapidly.

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

                      @Aviral-0 You can open the file, seek to file end and then connect a slot to https://doc.qt.io/qt-6/qfilesystemwatcher.html#fileChanged signal. In the slot you simply read to the end of the file and add the data you read to your log widget.

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

                      Aviral 0A 1 Reply Last reply
                      2
                      • jsulmJ jsulm

                        @Aviral-0 You can open the file, seek to file end and then connect a slot to https://doc.qt.io/qt-6/qfilesystemwatcher.html#fileChanged signal. In the slot you simply read to the end of the file and add the data you read to your log widget.

                        Aviral 0A Offline
                        Aviral 0A Offline
                        Aviral 0
                        wrote on last edited by
                        #13

                        @jsulm Hi, Please look at this
                        https://forum.qt.io/post/746818

                        1 Reply Last reply
                        0
                        • JonBJ JonB referenced this topic on

                        • Login

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