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. Last debug does not print anything :/
QtWS25 Last Chance

Last debug does not print anything :/

Scheduled Pinned Locked Moved Unsolved General and Desktop
qapplicationqdebugconsole
5 Posts 3 Posters 1.8k 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.
  • S Offline
    S Offline
    sami1592
    wrote on last edited by sami1592
    #1

    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
    0
    • Joel BodenmannJ Offline
      Joel BodenmannJ Offline
      Joel Bodenmann
      wrote on last edited by Joel Bodenmann
      #2

      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
      1
      • hskoglundH Offline
        hskoglundH Offline
        hskoglund
        wrote on last edited by
        #3

        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
        1
        • Joel BodenmannJ 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 :(

          S Offline
          S Offline
          sami1592
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0
          • hskoglundH hskoglund

            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 Offline
            S Offline
            sami1592
            wrote on last edited by
            #5

            @hskoglund Thanks for the info

            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