[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdelibs/kmdi
From:       Matt Rogers <mattr () kde ! org>
Date:       2005-01-17 4:55:39
Message-ID: 20050117045539.95F461CF4B () office ! kde ! org
[Download RAW message or body]

CVS commit by mattr: 

Fix bug 89048.

Make sure we take into account the toolbar and menubar sizes when creating the
toplevel widget. 

BUG: 89048


  M +39 -6     kmdimainfrm.cpp   1.88
  M +1 -0      kmdimainfrm.h   1.43


--- kdelibs/kmdi/kmdimainfrm.cpp  #1.87:1.88
@@ -56,4 +56,5 @@
 
 #include <qtoolbutton.h>
+#include <qdockarea.h>
 #include <qlayout.h>
 #include <qtimer.h>
@@ -254,4 +255,20 @@ KMdiMainFrm::KMdiMainFrm( QWidget* paren
         m_pDragEndTimer = new QTimer();
         connect( m_pDragEndTimer, SIGNAL( timeout() ), this, SLOT( dragEndTimeOut() \
) ); +        connect( guiFactory(), SIGNAL( clientAdded( KXMLGUIClient* ) ),
+                 this, SLOT( verifyToplevelHeight() ) );
+        connect( guiFactory(), SIGNAL( clientRemoved( KXMLGUIClient* ) ),
+                 this, SLOT( verifyToplevelHeight() ) );
+}
+
+void KMdiMainFrm::verifyToplevelHeight()
+{
+        if ( m_mdiMode != KMdi::ToplevelMode )
+                return;
+        
+        //kdDebug(760) << k_funcinfo << endl;
+        int topDockHeight = topDock() ? topDock()->height() : 0;
+        int menuBarHeight = hasMenuBar() ? menuBar()->height() : 0;
+        setFixedHeight( topDockHeight + menuBarHeight );
+        resize( width(), height() );
 }
 
@@ -1150,4 +1167,10 @@ bool KMdiMainFrm::event( QEvent* e )
 bool KMdiMainFrm::eventFilter( QObject * /*obj*/, QEvent *e )
 {
+        if ( e->type() == QEvent::Resize && m_mdiMode == KMdi::ToplevelMode )
+        {
+                verifyToplevelHeight();
+                return false; //let the rest of the resize magic do its work
+        }
+        
         if ( e->type() == QEvent::FocusIn )
         {
@@ -1377,11 +1400,21 @@ void KMdiMainFrm::switchToToplevelMode()
         if ( !parentWidget() )
         {
-                m_oldMainFrmMinHeight = minimumHeight();
-                m_oldMainFrmMaxHeight = maximumHeight();
-                m_oldMainFrmHeight = height();
+                //if we don't have a parent widget ( which i expect we wouldn't )
+                //make sure we take into account the size of the docks provided by
+                //QMainWindow
+                int topDockHeight = topDock() ? topDock()->height() : 0;
+                int bottomDockHeight = bottomDock() ? bottomDock()->height() : 0;
+                int menuBarHeight = hasMenuBar() ? menuBar()->height() : 0;
                 if ( m_pDocumentViews->count() != 0 )
                         setFixedHeight( height() - \
m_pDockbaseAreaOfDocumentViews->height() );  else
-                        setFixedHeight( height() - \
m_pDockbaseAreaOfDocumentViews->height() + 27 ); +                {
+                        kdDebug(760) << k_funcinfo << "height is: " << height() << \
endl; +                        kdDebug(760) << k_funcinfo << "top dock height: " << \
topDockHeight << endl; +                        kdDebug(760) << k_funcinfo << "bottom \
dock height: " << bottomDockHeight << endl; +                        kdDebug(760) << \
k_funcinfo << "menu bar height: " << menuBarHeight << endl; +                        \
kdDebug(760) << k_funcinfo << "dock base area height: " << \
m_pDockbaseAreaOfDocumentViews->height() << endl; +                        \
setFixedHeight( topDockHeight + menuBarHeight ); +                }
         }
 

--- kdelibs/kmdi/kmdimainfrm.h  #1.42:1.43
@@ -863,4 +863,5 @@ private slots:
         void removeFromActiveDockList( KMdiDockContainer* );
         void slotDocCurrentChanged( QWidget* );
+        void verifyToplevelHeight();
 #define protected public
 signals:


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic