Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Get info from terminal
Qt 6.11 is out! See what's new in the release blog

Get info from terminal

Scheduled Pinned Locked Moved 3rd Party Software
linuxterminalgettextnvidia-settings
12 Posts 3 Posters 6.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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    Shouldn't you rather use the nvidia management library for that task ?

    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
    0
    • SGaistS SGaist

      Hi,

      Shouldn't you rather use the nvidia management library for that task ?

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #3

      @SGaist oh yea i forgot about that!
      But my problem is how do i use the commands to get the text and place the result on a label (i only want to get the temp nothing else)

      1 Reply Last reply
      0
      • R Offline
        R Offline
        raf924
        wrote on last edited by
        #4

        See QProcess.

        ? 1 Reply Last reply
        0
        • R raf924

          See QProcess.

          ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #5

          @raf924 I don’t know how to get a specific area of the text i only want to pick the temp.(its the first time i am making a program that collects info from the system so i am bad at it...)

          1 Reply Last reply
          0
          • R Offline
            R Offline
            raf924
            wrote on last edited by
            #6

            Get the line with readLine, make it into a QString and split it then convert it to an integer and there you have it!

            ? 1 Reply Last reply
            0
            • R raf924

              Get the line with readLine, make it into a QString and split it then convert it to an integer and there you have it!

              ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #7

              @raf924 i am not realy sure how but i am going to try it. thnx

              R 1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #8

                QProcess is your friend

                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
                0
                • ? A Former User

                  @raf924 i am not realy sure how but i am going to try it. thnx

                  R Offline
                  R Offline
                  raf924
                  wrote on last edited by
                  #9

                  @BillGR17 If you're really stuck (although it's really not that complicated), I can give you the basic 3-4 lines of code but I believe it's always better to figure things out yourself instead of just copy-pasting code.

                  ? 1 Reply Last reply
                  0
                  • R raf924

                    @BillGR17 If you're really stuck (although it's really not that complicated), I can give you the basic 3-4 lines of code but I believe it's always better to figure things out yourself instead of just copy-pasting code.

                    ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #10

                    @raf924 yes i am really stuck.
                    The only example that i know is with txt and not with terminal.
                    I can take all the help u give me right now.

                    R 1 Reply Last reply
                    0
                    • ? A Former User

                      @raf924 yes i am really stuck.
                      The only example that i know is with txt and not with terminal.
                      I can take all the help u give me right now.

                      R Offline
                      R Offline
                      raf924
                      wrote on last edited by raf924
                      #11

                      @BillGR17 Have you even visited the links I gave you? Anyway here are the basic instructions

                      QProcess nvidia;
                      nvidia.start("nvidia-settings", QStringList()<< "-q" << "gpucoretemp");
                      nvidia.waitForFinished();
                      QByteArray output = nvidia.readLine();
                      int temp = QString(ouput).split(":").last().toInt();
                      

                      You might have to tweak the code a bit, I just put that together I don't know that it will compile but I don't see why it wouldn't.

                      ? 1 Reply Last reply
                      0
                      • R raf924

                        @BillGR17 Have you even visited the links I gave you? Anyway here are the basic instructions

                        QProcess nvidia;
                        nvidia.start("nvidia-settings", QStringList()<< "-q" << "gpucoretemp");
                        nvidia.waitForFinished();
                        QByteArray output = nvidia.readLine();
                        int temp = QString(ouput).split(":").last().toInt();
                        

                        You might have to tweak the code a bit, I just put that together I don't know that it will compile but I don't see why it wouldn't.

                        ? Offline
                        ? Offline
                        A Former User
                        wrote on last edited by
                        #12

                        @raf924 thanks you very very much! i am going to test it out right now!

                        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