Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt Application doesn't end on Android platform after calling QMainWindow::close()
Forum Updated to NodeBB v4.3 + New Features

Qt Application doesn't end on Android platform after calling QMainWindow::close()

Scheduled Pinned Locked Moved Mobile and Embedded
8 Posts 3 Posters 3.5k Views 1 Watching
  • 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.
  • P Offline
    P Offline
    plinioandrade
    wrote on 17 Sept 2014, 23:55 last edited by
    #1

    Hey everybody,
    I'm having so much trouble trying to figure out the problem related to my project. I'm developing a Android application on Qt (5.3.1) and I'm testing it on my smartphone (Samsung S4/Android 4.4) but when I press a button that call the
    QMainWindow::close() method the application just hides but not close. Is someone having the same problem? Do you guys have some idea about the problem. Sincerely,

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dheerendra
      Qt Champions 2022
      wrote on 18 Sept 2014, 08:58 last edited by
      #2

      QMainWindow is supposed to close on the QMainWindow instances. It is true with any platform. Did you manipulate any flags like Qt::WA_QuitOnClose ?

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • P Offline
        P Offline
        plinioandrade
        wrote on 18 Sept 2014, 11:49 last edited by
        #3

        [quote author="Dheerendra" date="1411030715"]QMainWindow is supposed to close on the QMainWindow instances. It is true with any platform. Did you manipulate any flags like Qt::WA_QuitOnClose ?[/quote]

        I didn't use any Flags. It's too weird because I reimplemented the event close of the QMainWindow and I noticed it isn't even been called. Do you have some suggestions?

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dheerendra
          Qt Champions 2022
          wrote on 18 Sept 2014, 13:21 last edited by
          #4

          Where are you trying this ? I experimented with Nexus and application exits. Can you give me your sample source ?

          int main(int argc, char *argv[])
          {
          QApplication a(argc, argv);
          Widget m;
          QMainWindow w;
          QPushButton button("pthinks.com",&w);
          w.show();
          QObject::connect(&button,SIGNAL(clicked()),&w,SLOT(close()));
          QObject::connect(&button,SIGNAL(clicked()),&button,SLOT(close()));
          a.exec();

          qDebug() << " I am here "<< endl;
          return 1;
          

          }

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          1 Reply Last reply
          0
          • P Offline
            P Offline
            plinioandrade
            wrote on 18 Sept 2014, 13:43 last edited by
            #5

            Actually I did it:
            @#include "mainwindow.h"
            #include <QApplication>
            #include <QPushButton>
            int main(int argc, char *argv[])
            {
            QApplication a(argc, argv);
            MainWindow w;
            QPushButton b("Ola Mundo",&w);
            //QObject::connect(&b,SIGNAL(clicked()),&w,SLOT(close()));
            QObject::connect(&b,SIGNAL(clicked()),&a,SLOT(closeAllWindows()));
            w.show();
            return a.exec();
            }
            @
            I tried both connections alternating between them and together but the application keep running after the Button has been clicked.
            The application hide but it's still running. I'm using Android SDK API 19 with NDK r9d and Ant 1.9.4. I'm testing it on my T-Mobile Samsung S4 (Android 4.4.2). Does my code work for you? Sincerely,
            [quote author="Dheerendra" date="1411046465"]Where are you trying this ? I experimented with Nexus and application exits. Can you give me your sample source ?

            int main(int argc, char *argv[])
            {
            QApplication a(argc, argv);
            Widget m;
            QMainWindow w;
            QPushButton button("pthinks.com",&w);
            w.show();
            QObject::connect(&button,SIGNAL(clicked()),&w,SLOT(close()));
            QObject::connect(&button,SIGNAL(clicked()),&button,SLOT(close()));
            a.exec();

            qDebug(&#41; << " I am here "<< endl;
            return 1;
            

            }
            [/quote]

            1 Reply Last reply
            0
            • D Offline
              D Offline
              dheerendra
              Qt Champions 2022
              wrote on 18 Sept 2014, 14:39 last edited by
              #6

              I tried your same application and it works fine for me on Nexus. I am using NDK r10 32 bit, with Qt 5.3.x. It quits. It may be specific issue.

              Dheerendra
              @Community Service
              Certified Qt Specialist
              http://www.pthinks.com

              1 Reply Last reply
              0
              • P Offline
                P Offline
                plinioandrade
                wrote on 18 Sept 2014, 14:57 last edited by
                #7

                [quote author="Dheerendra" date="1411051171"]I tried your same application and it works fine for me on Nexus. I am using NDK r10 32 bit, with Qt 5.3.x. It quits. It may be specific issue.[/quote]
                I will try it on other device and see what happen. I used the r10 on linux and it didn't work again. Thank you for your concerning and I will let you know.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  s.frings74
                  wrote on 21 Sept 2014, 17:11 last edited by
                  #8

                  Just to clarifiy / preven misunderstanding:

                  Do you think the application is still running because it still apears in the list of recently used apps that opens when you hold the menu button down?

                  This List does not show running applications! It shows the last used application. Even Java apps remains in the list when they exit.

                  1 Reply Last reply
                  0

                  1/8

                  17 Sept 2014, 23:55

                  • Login

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