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. Destroy all windows

Destroy all windows

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 5 Posters 1.3k 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.
  • A Offline
    A Offline
    ayoubBD
    wrote on last edited by
    #1

    hi frends,
    please how I can destroy all windows with puchbutton

    Taz742T 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      How do you create them?
      Normally, you can just use the variable to delete them again.
      There is also close() to close them but it all depends on what you are doing :)

      A 1 Reply Last reply
      0
      • mrjjM mrjj

        Hi
        How do you create them?
        Normally, you can just use the variable to delete them again.
        There is also close() to close them but it all depends on what you are doing :)

        A Offline
        A Offline
        ayoubBD
        wrote on last edited by
        #3

        @mrjj I create them with QT disigner

        mrjjM 1 Reply Last reply
        0
        • A ayoubBD

          @mrjj I create them with QT disigner

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @ayoubBD
          ok, but how do you open/show then?
          just put the variables as member in .h
          and keep them around after you new the forms.

          i assume you do something like

          MyForm * form=new MyForm(this) ?

          1 Reply Last reply
          1
          • S Offline
            S Offline
            Slawomir_Piernikowski
            wrote on last edited by Slawomir_Piernikowski
            #5

            If the Form pointer is named for example "formPointer" just delete it in the on_Pushbutton function(slot in header file) :
            delete formPointer;
            formPointer = nullptr;
            Then Form will disappear. So You can not have it back, but if You want just to hide it and show it again on some action.
            You can do this:
            formPointer->hide();
            And if You want to have it back You can do this:
            formPointer->show();

            1 Reply Last reply
            0
            • VRoninV Offline
              VRoninV Offline
              VRonin
              wrote on last edited by
              #6

              <joke>QObject::connect(button,SIGNAL(clicked()),vandal,SLOT(throwBricks()));</joke>

              "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
              ~Napoleon Bonaparte

              On a crusade to banish setIndexWidget() from the holy land of Qt

              1 Reply Last reply
              2
              • A ayoubBD

                hi frends,
                please how I can destroy all windows with puchbutton

                Taz742T Offline
                Taz742T Offline
                Taz742
                wrote on last edited by
                #7

                @ayoubBD

                connect(ui->pushButton, &QPushButton::clicked, qApp, &QApplication::closeAllWindows);
                

                Do what you want.

                1 Reply Last reply
                3

                • Login

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