Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Solved is there an event/signal which happens when the QMdiarea become empty?

    General and Desktop
    3
    4
    710
    Loading More Posts
    • 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
      Prmego last edited by

      I want to implement a code when QMdiarea is empty i.e. (has no QSubWindow children).

      For example:

      is there an event or signal which happens when the QMdiarea become empty?

      1 Reply Last reply Reply Quote 0
      • ?
        A Former User last edited by

        Hi! If you're using tabs as your subwindows, then listening to the subWindowActivated signal might be enough. But I'm not 100% sure.

        1 Reply Last reply Reply Quote 3
        • Vinod Kuntoji
          Vinod Kuntoji last edited by

          connect(mdiArea,SIGNAL(subWindowActivated(QMdiSubWindow*)),this,SLOT(getSubwindowCount()));

          static int count = mdiArea->subWindowList().size();
          if(!subWindow->isVisible()) {
          --count;
          }
          if(!subWindow1->isVisible()) {
          --count;
          }
          qDebug() << Q_FUNC_INFO <<count;

          if count is Zero, mdiArea will be empty.

          C++, Qt, Qt Quick Developer,
          PthinkS, Bangalore

          1 Reply Last reply Reply Quote 5
          • P
            Prmego last edited by

            Yes, it's work fine. so the subWindowActivated is the right signal for that job.
            I thank @Wieland and @Vinod-Kuntoji for helping me.

            1 Reply Last reply Reply Quote 2
            • First post
              Last post