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

void QextMdiMainFrm::findRootDockWidgets ( QList< KDockWidget > *  pRootDockWidgetList,
QValueList< QRect > *  pPositionList 
)

find the root dockwidgets and store their geometry

Definition at line 902 of file qextmdimainfrm.cpp.

Referenced by switchToChildframeMode(), and switchToToplevelMode().

{
   if (!pRootDockWidgetList) return;
   if (!pPositionList) return;

   // since we set some windows to toplevel, we must consider the window manager's window frame
   const int frameBorderWidth  = 7;  // TODO: Can we / do we need to ask the window manager?
   const int windowTitleHeight = 10; // TODO:    -"-

   QObjectList* pObjList = queryList( "KDockWidget");
   QObjectListIt it( *pObjList);
   QObject* pObj;
   // for all dockwidgets (which are children of this mainwindow)
   while ((pObj = it.current()) != 0L) {
      ++it;
      KDockWidget* pDockW = (KDockWidget*) pObj;
      KDockWidget* pRootDockW = 0L;
      KDockWidget* pUndockCandidate = 0L;
      QWidget* pW = pDockW;
      // find the oldest ancestor of the current dockwidget that can be undocked
      while (!pW->isTopLevel()) {
         if (pW->inherits("KDockWidget")) {
            pUndockCandidate = (KDockWidget*) pW;
            if (pUndockCandidate->enableDocking() != KDockWidget::DockNone)
               pRootDockW = pUndockCandidate;
         }
         pW = pW->parentWidget();
      }
      if (pRootDockW) {
         // if that oldest ancestor is not already in the list, append it
         bool found = FALSE;
#if QT_VERSION < 300
         QListIterator<KDockWidget> it2( *pRootDockWidgetList);
#else
         QPtrListIterator<KDockWidget> it2( *pRootDockWidgetList);
#endif
         if (!pRootDockWidgetList->isEmpty()) {
            for ( ; it2.current() && !found; ++it2 ) {
               KDockWidget* pDockW = it2.current();
               if (pDockW == pRootDockW)
                  found = TRUE;
            }
            if (!found) {
               pRootDockWidgetList->append( pDockW);
               QPoint p = pDockW->mapToGlobal( pDockW->pos())-pDockW->pos();
               QRect r( p.x(),
                        p.y()+m_undockPositioningOffset.y(),
                        pDockW->width()  - windowTitleHeight - frameBorderWidth*2,
                        pDockW->height() - windowTitleHeight - frameBorderWidth*2);
               pPositionList->append( r);
            }
         }
         else {
            pRootDockWidgetList->append( pRootDockW);
            QPoint p = pRootDockW->mapToGlobal( pRootDockW->pos())-pRootDockW->pos();
            QRect r( p.x(),
                     p.y()+m_undockPositioningOffset.y(),
                     pRootDockW->width()  - windowTitleHeight - frameBorderWidth*2,
                     pRootDockW->height() - windowTitleHeight - frameBorderWidth*2);
            pPositionList->append( r);
         }
      }
   }
}


Generated by  Doxygen 1.6.0   Back to index