Last debug does not print anything :/



  • 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 :(



  • 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 :(



  • 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.



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



  • @hskoglund Thanks for the info


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.