Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    Unsolved Last debug does not print anything :/

    General and Desktop
    qapplication qdebug console
    3
    5
    1429
    Loading More Posts
    • 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.
    • S
      sami1592 last edited by sami1592

      The last debug (qDebug() << QTime::currentTime()) of the program is not printing anything :/ Can anyone shed some light on this matter?

      #include <QtWidgets>
      #include <QString>
      #include <QDebug>
      #include <QTime>
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
      
          QWindow window;
          window.show();
      
          qDebug() << "BEFORE: Double click interval : " << QApplication::doubleClickInterval();
          qDebug() << QTime::currentTime();
      
          QApplication::setDoubleClickInterval(300);
      
          qDebug() << "AFTER: Double click interval : " << QApplication::doubleClickInterval();
          qDebug() << QTime::currentTime();
      
          int i = app.exec();
      
          qDebug() << "Returen value of QApplication: " << i;
          qDebug() << QTime::currentTime();
      
      
          return i;
      }
      
      

      Output:

      Starting C:\Qt\Qt5.5.1\Examples\Qt-5.5\widgets\tutorials\widgets\build-toplevel-Desktop_Qt_5_5_1_MSVC2013_64bit-Debug\debug\toplevel.exe...
      BEFORE: Double click interval :  500
      QTime("00:15:30.090")
      AFTER: Double click interval :  300
      QTime("00:15:30.201")
      Returen value of QApplication:  0
      C:\Qt\Qt5.5.1\Examples\Qt-5.5\widgets\tutorials\widgets\build-toplevel-Desktop_Qt_5_5_1_MSVC2013_64bit-Debug\debug\toplevel.exe exited with code 0
      

      PS: Cannot find any option to include any screenshot, it would have made my problem a bit clearer :(

      1 Reply Last reply Reply Quote 0
      • Joel Bodenmann
        Joel Bodenmann last edited by Joel Bodenmann

        I just copy-pasted your code and it works as expected here:

        BEFORE: Double click interval :  500
        QTime("19:28:45.178")
        AFTER: Double click interval :  300
        QTime("19:28:45.240")
        Returen value of QApplication:  0
        QTime("19:28:47.181")
        

        I am using Qt 5.4.2 on a Windows 10 64-Bit machine. Compiler is MinGW.
        Sadly I can't provide anything more useful than that information :(

        Industrial process automation software: https://simulton.com
        Embedded Graphics & GUI library: https://ugfx.io

        S 1 Reply Last reply Reply Quote 1
        • hskoglund
          hskoglund last edited by

          Hi, once you call app.exec(); all bets are off on how much qDebug() output that will survive (I think it's platform dependent).
          When compiling with 32b-bit Visual Studio 2013, I get the same behavior as you, i.e. that last QTime::currentTime() is thrown awat because the app is exiting. Using MingGW (@Joel-Bodenmann above) it seems you are a bit more lucky.

          S 1 Reply Last reply Reply Quote 1
          • S
            sami1592 @Joel Bodenmann last edited by

            @Joel-Bodenmann Behavior in my machine is a bit random. Thanks for the effort, it's much appreciated :)

            1 Reply Last reply Reply Quote 0
            • S
              sami1592 @hskoglund last edited by

              @hskoglund Thanks for the info

              1 Reply Last reply Reply Quote 0
              • First post
                Last post