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. QApplication does not exits if last window is closed with MSVC2015 WinRT 64bit

QApplication does not exits if last window is closed with MSVC2015 WinRT 64bit

Scheduled Pinned Locked Moved Unsolved General and Desktop
msvcmsvc2015winrtqmainwindowqapplication
7 Posts 3 Posters 3.1k 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.
  • B Offline
    B Offline
    Baarnus
    wrote on 21 May 2016, 17:04 last edited by
    #1

    Hello! The issue is that if I complile an app with Qt WinRT (alias UWP), when I close the last window, the app is not exiting.
    It seems as the lastWindowClosed singal is not emitted, since neither the "CLOSED" neither the "Hello" is not printed in the app below, and the app exits with code 1.
    The error is not present if I compile it as a desktop app with msvc2015.

    Compiler: msvc2015
    Qt: 5.6.0 msvc2015 / WinRT with msvc 2015
    IDE: Qt creator
    OS: Windows 10

    Output:

    qt.winrtrunner: Using the Appx profile.
    qt.winrtrunner: Package already installed.
    qt.winrtrunner: App started with process ID 7584
    qt.winrtrunner: App exited with code 1
    

    My code:

    main.cpp:

    #include <QApplication>
    #include <QMainWindow>
    #include <QDebug>
    
    int main(int argc, char *argv[])
    {
      QApplication a(argc, argv);
      QObject::connect( &a, &QApplication::lastWindowClosed, [](){ qDebug() << "CLOSED"; } );
      QMainWindow w;
      w.show();
      auto ret = a.exec();
      qDebug() << "Hello!";
      return ret;
    }
    

    TEST.pro:

    #-------------------------------------------------
    #
    # Project created by QtCreator 2016-05-21T18:11:15
    #
    #-------------------------------------------------
    
    QT       += core gui
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    TARGET = TEST
    TEMPLATE = app
    
    
    SOURCES += main.cpp
    
    HEADERS  +=
    
    FORMS    +=
    
    

    It has came out when I run my own project, but it is the same with this simple example.
    Am I doing something wrong, or is this a bug?
    Thanks!

    K 1 Reply Last reply 21 May 2016, 17:09
    0
    • B Baarnus
      21 May 2016, 17:04

      Hello! The issue is that if I complile an app with Qt WinRT (alias UWP), when I close the last window, the app is not exiting.
      It seems as the lastWindowClosed singal is not emitted, since neither the "CLOSED" neither the "Hello" is not printed in the app below, and the app exits with code 1.
      The error is not present if I compile it as a desktop app with msvc2015.

      Compiler: msvc2015
      Qt: 5.6.0 msvc2015 / WinRT with msvc 2015
      IDE: Qt creator
      OS: Windows 10

      Output:

      qt.winrtrunner: Using the Appx profile.
      qt.winrtrunner: Package already installed.
      qt.winrtrunner: App started with process ID 7584
      qt.winrtrunner: App exited with code 1
      

      My code:

      main.cpp:

      #include <QApplication>
      #include <QMainWindow>
      #include <QDebug>
      
      int main(int argc, char *argv[])
      {
        QApplication a(argc, argv);
        QObject::connect( &a, &QApplication::lastWindowClosed, [](){ qDebug() << "CLOSED"; } );
        QMainWindow w;
        w.show();
        auto ret = a.exec();
        qDebug() << "Hello!";
        return ret;
      }
      

      TEST.pro:

      #-------------------------------------------------
      #
      # Project created by QtCreator 2016-05-21T18:11:15
      #
      #-------------------------------------------------
      
      QT       += core gui
      
      greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
      
      TARGET = TEST
      TEMPLATE = app
      
      
      SOURCES += main.cpp
      
      HEADERS  +=
      
      FORMS    +=
      
      

      It has came out when I run my own project, but it is the same with this simple example.
      Am I doing something wrong, or is this a bug?
      Thanks!

      K Offline
      K Offline
      kshegunov
      Moderators
      wrote on 21 May 2016, 17:09 last edited by kshegunov
      #2

      @Baarnus
      Hello,

      Am I doing something wrong, or is this a bug?

      The code looks perfectly fine to me. Possibly a bug or some OS idiosyncrasy. However, this:

      qt.winrtrunner: App exited with code 1

      Leads me to believe the app actually exits. Perhaps you just don't see the output from qDebug?

      Read and abide by the Qt Code of Conduct

      B 1 Reply Last reply 21 May 2016, 17:18
      0
      • K kshegunov
        21 May 2016, 17:09

        @Baarnus
        Hello,

        Am I doing something wrong, or is this a bug?

        The code looks perfectly fine to me. Possibly a bug or some OS idiosyncrasy. However, this:

        qt.winrtrunner: App exited with code 1

        Leads me to believe the app actually exits. Perhaps you just don't see the output from qDebug?

        B Offline
        B Offline
        Baarnus
        wrote on 21 May 2016, 17:18 last edited by
        #3

        @kshegunov

        Leads me to believe the app actually exits. Perhaps you just don't see the output from qDebug?

        Valid point. I have tried print something before the a.exec() and they are shown in the output as expected.

        Maybe only the winrtrunner says that the app is exited, but it is exited for other reason. I don't know.

        K 1 Reply Last reply 21 May 2016, 18:38
        0
        • B Baarnus
          21 May 2016, 17:18

          @kshegunov

          Leads me to believe the app actually exits. Perhaps you just don't see the output from qDebug?

          Valid point. I have tried print something before the a.exec() and they are shown in the output as expected.

          Maybe only the winrtrunner says that the app is exited, but it is exited for other reason. I don't know.

          K Offline
          K Offline
          kshegunov
          Moderators
          wrote on 21 May 2016, 18:38 last edited by
          #4

          @Baarnus
          I have no experience with winrt, but I see no reason for the app not to exit. Could you check if the process finishes so we know whether it's the app iself, or there's some problem with the printing?

          Read and abide by the Qt Code of Conduct

          B 1 Reply Last reply 22 May 2016, 18:14
          0
          • K kshegunov
            21 May 2016, 18:38

            @Baarnus
            I have no experience with winrt, but I see no reason for the app not to exit. Could you check if the process finishes so we know whether it's the app iself, or there's some problem with the printing?

            B Offline
            B Offline
            Baarnus
            wrote on 22 May 2016, 18:14 last edited by
            #5

            @kshegunov
            I checked: the process disappears from the task manager just when qt.winrtrunner: App exited with code 1 is written into the output. So I think the process is running. I can only think that the lastWindowClosed signal isn't emitted, which seems to me as a bug. Tomorrow I will test it on my workplace machine.

            K 1 Reply Last reply 22 May 2016, 18:27
            0
            • B Baarnus
              22 May 2016, 18:14

              @kshegunov
              I checked: the process disappears from the task manager just when qt.winrtrunner: App exited with code 1 is written into the output. So I think the process is running. I can only think that the lastWindowClosed signal isn't emitted, which seems to me as a bug. Tomorrow I will test it on my workplace machine.

              K Offline
              K Offline
              kshegunov
              Moderators
              wrote on 22 May 2016, 18:27 last edited by
              #6

              @Baarnus said:

              the process disappears from the task manager just when qt.winrtrunner: App exited with code 1 is written into the output.

              This'd mean the process exits okay. So you should perhaps focus on why you can't see the output. There may be a bug somewhere with the WinRT implementation or something else, but I'd thoroughly check everything else first. For example, what happens if you use:

              QTextStream out(stdout);
              out << "CLOSED" << endl;
              

              instead of qDebug() << "CLOSED";, is this printed/visible?

              Read and abide by the Qt Code of Conduct

              1 Reply Last reply
              0
              • H Online
                H Online
                hskoglund
                wrote on 22 May 2016, 20:33 last edited by
                #7

                Hi, just to want add, while Qt Creator's capturing of your qDebug() output is usually 100%, but if you want to be sure to get everything, you could try running DebugView when your app exits.

                1 Reply Last reply
                0

                4/7

                21 May 2016, 18:38

                • Login

                • Login or register to search.
                4 out of 7
                • First post
                  4/7
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved