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. Print to screen from qDebug
Forum Update on Monday, May 27th 2025

Print to screen from qDebug

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 829 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.
  • MijazM Offline
    MijazM Offline
    Mijaz
    wrote on last edited by
    #1
    QProcess process;
    

    process.start("sudo devmem2 0x80000000");
    process.waitForFinished(-1); // will wait forever until finished

    QString stdout = process.readAllStandardOutput();
    QString stderr = process.readAllStandardError();

    qDebug() << stdout;
    ui->lineEdit->setText(qDebug());
    

    I want to display my qDebug to lineEdit in Qt.

    JonBJ 1 Reply Last reply
    0
    • MijazM Mijaz
      QProcess process;
      

      process.start("sudo devmem2 0x80000000");
      process.waitForFinished(-1); // will wait forever until finished

      QString stdout = process.readAllStandardOutput();
      QString stderr = process.readAllStandardError();

      qDebug() << stdout;
      ui->lineEdit->setText(qDebug());
      

      I want to display my qDebug to lineEdit in Qt.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Mijaz
      Your stdout is just a QString. So why qDebug()? You just need ui->lineEdit->setText(stdout);.

      MijazM 1 Reply Last reply
      2
      • JonBJ JonB

        @Mijaz
        Your stdout is just a QString. So why qDebug()? You just need ui->lineEdit->setText(stdout);.

        MijazM Offline
        MijazM Offline
        Mijaz
        wrote on last edited by Mijaz
        #3

        Hi @JonB Thanks, it works...

        Can I define range like this?
        ui->lineEdit->setText(stdout[90:105]);

        JonBJ 1 Reply Last reply
        0
        • MijazM Mijaz

          Hi @JonB Thanks, it works...

          Can I define range like this?
          ui->lineEdit->setText(stdout[90:105]);

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @Mijaz
          Where does QString (or C++) define a [start:end] "range operator"? Since it does not (you're not in Python!), no you cannot do that. Read the docs for QString, e.g. https://doc.qt.io/qt-5/qstring.html#mid.

          J.HilkJ 1 Reply Last reply
          1
          • JonBJ JonB

            @Mijaz
            Where does QString (or C++) define a [start:end] "range operator"? Since it does not (you're not in Python!), no you cannot do that. Read the docs for QString, e.g. https://doc.qt.io/qt-5/qstring.html#mid.

            J.HilkJ Online
            J.HilkJ Online
            J.Hilk
            Moderators
            wrote on last edited by
            #5

            @JonB not yet, but there's an awful amount of talking about it for c++20 ....


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            JonBJ 1 Reply Last reply
            0
            • J.HilkJ J.Hilk

              @JonB not yet, but there's an awful amount of talking about it for c++20 ....

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @J-Hilk
              Just great. C was fine, let's make C++ more like hideous Python... ;-)

              J.HilkJ 1 Reply Last reply
              0
              • JonBJ JonB

                @J-Hilk
                Just great. C was fine, let's make C++ more like hideous Python... ;-)

                J.HilkJ Online
                J.HilkJ Online
                J.Hilk
                Moderators
                wrote on last edited by J.Hilk
                #7

                @JonB well, that's one way of looking at it, I think its nice, that after 35 Years, the user base still grows and the language still adapts new features :)

                look at this beauty and tell me its hideous :P

                int main()
                {
                    std::vector<int> ints{0,1,2,3,4,5};
                    auto even = [](int i){ return 0 == i % 2; };
                    auto square = [](int i) { return i * i; };
                 
                    for (int i : ints | std::views::filter(even) | std::views::transform(square)) {
                        std::cout << i << ' ';
                    }
                }
                
                //Output: 0 4 16
                

                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                JonBJ 1 Reply Last reply
                0
                • J.HilkJ J.Hilk

                  @JonB well, that's one way of looking at it, I think its nice, that after 35 Years, the user base still grows and the language still adapts new features :)

                  look at this beauty and tell me its hideous :P

                  int main()
                  {
                      std::vector<int> ints{0,1,2,3,4,5};
                      auto even = [](int i){ return 0 == i % 2; };
                      auto square = [](int i) { return i * i; };
                   
                      for (int i : ints | std::views::filter(even) | std::views::transform(square)) {
                          std::cout << i << ' ';
                      }
                  }
                  
                  //Output: 0 4 16
                  
                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by JonB
                  #8

                  @J-Hilk
                  This is probably not the place for a discussion, but yes I think it's hard to read/understand. WTF is that | logical-or operator doing in the for against arrays? (Yes, I can guess...) Is it really easier to read or more efficient than an if inside the loop? Depending on how that for ( ... | ...) is implemented, it could be hideously inefficient!

                  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