Logo Search packages:      
Sourcecode: kbear version File versions  Download package

void QextMdiMainFrm::removeWindowFromMdi ( QextMdiChildView pWnd  )  [virtual, slot]

Removes a QextMdiChildView from the MDI system and from the main frame`s control. Note: The view will not be deleted, but it's getting toplevel (reparent to 0)!

Definition at line 534 of file qextmdimainfrm.cpp.

References QextMdiChildView::activate(), activateView(), attachWindow(), childWindowCloseRequest(), QextMdiChildArea::destroyChildButNotItsView(), detachWindow(), dockMenuItemActivated(), QextMdiTaskBar::getButton(), QextMdiChildArea::getVisibleChildCount(), QextMdiChildView::isAttached(), QextMdiChildView::isToolView(), lastChildViewClosed(), QextMdiChildView::m_bToolView, QextMdiChildFrm::m_pClient, QextMdiChildView::mdiParent(), QextMdiTaskBar::removeWinButton(), QextMdiChildArea::topChild(), and windowMenuItemActivated().

Referenced by KBear::slotOptionsShowViewLocal().

{
   //Closes a child window. sends no close event : simply deletes it
   if (!(m_pWinList->removeRef(pWnd)))
      return;
   if (m_pWinList->count() == 0)
     m_pCurrentWindow = 0L;

   QObject::disconnect( pWnd, SIGNAL(attachWindow(QextMdiChildView*,bool)), this, SLOT(attachWindow(QextMdiChildView*,bool)) );
   QObject::disconnect( pWnd, SIGNAL(detachWindow(QextMdiChildView*,bool)), this, SLOT(detachWindow(QextMdiChildView*,bool)) );
   QObject::disconnect( pWnd, SIGNAL(focusInEventOccurs(QextMdiChildView*)), this, SLOT(activateView(QextMdiChildView*)) );
   QObject::disconnect( pWnd, SIGNAL(childWindowCloseRequest(QextMdiChildView*)), this, SLOT(childWindowCloseRequest(QextMdiChildView*)) );
   QObject::disconnect( pWnd, SIGNAL(clickedInWindowMenu(int)), this, SLOT(windowMenuItemActivated(int)) );
   QObject::disconnect( pWnd, SIGNAL(clickedInDockMenu(int)), this, SLOT(dockMenuItemActivated(int)) );

   if (m_pTaskBar) {
      QextMdiTaskBarButton* but = m_pTaskBar->getButton(pWnd);
      if (but != 0L) {
         QObject::disconnect( pWnd, SIGNAL(tabCaptionChanged(const QString&)), but, SLOT(setNewText(const QString&)) );
      }
      m_pTaskBar->removeWinButton(pWnd);
   }

   if (m_mdiMode == QextMdi::TabPageMode) {
      if (m_pWinList->count() == 0) {
         if (!m_pDockbaseAreaOfDocumentViews) {
            m_pDockbaseAreaOfDocumentViews = createDockWidget( "mdiAreaCover", QPixmap(), 0L, "mdi_area_cover");
            m_pDockbaseAreaOfDocumentViews->setWidget(m_pMdi);
            setMainDockWidget(m_pDockbaseAreaOfDocumentViews);
         }
         m_pDockbaseOfTabPage->setDockSite(KDockWidget::DockFullSite);
         m_pDockbaseAreaOfDocumentViews->setEnableDocking(KDockWidget::DockCenter);
         m_pDockbaseAreaOfDocumentViews->manualDock( m_pDockbaseOfTabPage, KDockWidget::DockCenter);
         m_pDockbaseAreaOfDocumentViews->setEnableDocking(KDockWidget::DockNone);
         m_pDockbaseOfTabPage = m_pDockbaseAreaOfDocumentViews;
      }
      KDockWidget* pDockW = (KDockWidget*) pWnd->parentWidget();
      pWnd->reparent(0L, QPoint(0,0));
      pDockW->setWidget(0L);
      if (pDockW == m_pDockbaseOfTabPage) {
#if !defined(NO_KDE2) && (QT_VERSION >= 300)
         QTabWidget* pTab = (QTabWidget*) pDockW->parentWidget()->parentWidget();
         int cnt = pTab->count();
         m_pDockbaseOfTabPage = (KDockWidget*) pTab->page(cnt - 2);
         if (pDockW == m_pDockbaseOfTabPage) {
            m_pDockbaseOfTabPage = (KDockWidget*) pTab->page(cnt - 1); // different to the one deleted next
         }
#else
         KDockTabCtl* pTab = (KDockTabCtl*) pDockW->parentWidget()->parentWidget();
         KDockWidget* pLastPage = (KDockWidget*) pTab->getLastPage();
         m_pDockbaseOfTabPage = (KDockWidget*) pTab->getPrevPage(pLastPage);
         if (pDockW == m_pDockbaseOfTabPage) {
            m_pDockbaseOfTabPage = pLastPage;
         }
#endif
      }
      delete pDockW;
   }
   else if (pWnd->isAttached()) {
      pWnd->mdiParent()->hide();
      m_pMdi->destroyChildButNotItsView(pWnd->mdiParent());
   }
   else {
      // is not attached
      if (m_pMdi->getVisibleChildCount() > 0) {
         setActiveWindow();
         m_pCurrentWindow = 0L;
         QextMdiChildView* pView = m_pMdi->topChild()->m_pClient;
         if (pView) {
            pView->activate();
         }
      }
      else if (m_pWinList->count() > 0) {
//crash?         m_pWinList->last()->activate();
//crash?         m_pWinList->last()->setFocus();
      }
   }

   if (pWnd->isToolView())
      pWnd->m_bToolView = FALSE;

   if (!m_pCurrentWindow)
      emit lastChildViewClosed();
}


Generated by  Doxygen 1.6.0   Back to index