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

List:       kde-commits
Subject:    branches/KDE/3.5/kdepim/korganizer
From:       Reinhold Kainhofer <reinhold () kainhofer ! com>
Date:       2005-08-29 22:51:11
Message-ID: 1125355871.970473.10155.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 454796 by kainhofe:

It seems that we shouldn't try to lay out all child items of the agenda in the \
resizeEvent method, since that somehow messes up the QSplitter handling in Qt. \
Instead, only calculate the grid size in the resizeEvent, and do the re-layouting of \
the agenda items in a slot called by a single shot timer. This fixes bug 80114. \
Similarly, do the layouting of the day matrices in the date navigator in a \
single-shot timer, since this makes the other splitters resize immediately. (The day \
matrices take some time, so this makes korganizer appear faster... see also Lubos' \
talk on KDE Performance here in malaga...)

BUG:80114



 M  +5 -0      datenavigatorcontainer.cpp  
 M  +6 -0      datenavigatorcontainer.h  
 M  +16 -12    koagenda.cpp  
 M  +7 -2      koagenda.h  


--- branches/KDE/3.5/kdepim/korganizer/datenavigatorcontainer.cpp #454795:454796
@@ -36,6 +36,7 @@
 #include "datenavigatorcontainer.h"
 
 #include <qwhatsthis.h>
+#include <qtimer.h>
 
 DateNavigatorContainer::DateNavigatorContainer( QWidget *parent,
                                                 const char *name )
@@ -185,7 +186,11 @@
   kdDebug(5850) << "  SIZEHINT: " << sizeHint() << endl;
   kdDebug(5850) << "  MINIMUM SIZE: " << minimumSize() << endl;
 #endif
+  QTimer::singleShot( 0, this, SLOT( resizeAllContents() ) );
+}
 
+void DateNavigatorContainer::resizeAllContents()
+{
   QSize minSize = mNavigatorView->minimumSizeHint();
 
 //  kdDebug(5850) << "  NAVIGATORVIEW minimumSizeHint: " << minSize << endl;
--- branches/KDE/3.5/kdepim/korganizer/datenavigatorcontainer.h #454795:454796
@@ -71,6 +71,12 @@
     void resizeEvent( QResizeEvent * );
     void setBaseDates( const QDate &start );
     void connectNavigatorView( KDateNavigator *v );
+  protected slots:
+    /** Resizes all the child elements after the size of the widget
+        changed. This slot is called by a QTimer::singleShot from
+        resizeEvent. This makes the UI seem more responsive, since
+        the other parts of the splitter are resized earlier now */
+    void resizeAllContents();
 
   private:
     KDateNavigator *mNavigatorView;
--- branches/KDE/3.5/kdepim/korganizer/koagenda.cpp #454795:454796
@@ -1776,36 +1776,40 @@
 void KOAgenda::resizeEvent ( QResizeEvent *ev )
 {
 //  kdDebug(5850) << "KOAgenda::resizeEvent" << endl;
-  double subCellWidth;
-  KOAgendaItem *item;
+
   QSize newSize( ev->size() );
   if (mAllDayMode) {
     mGridSpacingX = double( newSize.width() - 2 * frameWidth() ) / (double)mColumns;
     mGridSpacingY = newSize.height() - 2 * frameWidth();
-
-    for ( item=mItems.first(); item != 0; item=mItems.next() ) {
-      subCellWidth = calcSubCellWidth( item );
-      placeAgendaItem( item, subCellWidth );
-    }
   } else {
     mGridSpacingX = double( newSize.width() - verticalScrollBar()->width() - 2 * \
frameWidth()) / double(mColumns);  // make sure that there are not more than 24 per \
                day
     mGridSpacingY = double(newSize.height() - 2 * frameWidth()) / double(mRows);
     if ( mGridSpacingY < mDesiredGridSpacingY )
       mGridSpacingY = mDesiredGridSpacingY;
+  }
+  calculateWorkingHours();
+  QTimer::singleShot( 0, this, SLOT( resizeAllContents() ) );
+  QScrollView::resizeEvent(ev);
+}
 
+void KOAgenda::resizeAllContents()
+{
+  double subCellWidth;
+  KOAgendaItem *item;
+  if (mAllDayMode) {
     for ( item=mItems.first(); item != 0; item=mItems.next() ) {
       subCellWidth = calcSubCellWidth( item );
       placeAgendaItem( item, subCellWidth );
     }
+  } else {
+    for ( item=mItems.first(); item != 0; item=mItems.next() ) {
+      subCellWidth = calcSubCellWidth( item );
+      placeAgendaItem( item, subCellWidth );
+    }
   }
-
   checkScrollBoundaries();
-  calculateWorkingHours();
-
   marcus_bains();
-
-  QScrollView::resizeEvent(ev);
 }
 
 
--- branches/KDE/3.5/kdepim/korganizer/koagenda.h #454795:454796
@@ -210,10 +210,10 @@
 
     /** Handles mouse events. Called from eventFilter */
     virtual bool eventFilter_mouse ( QObject *, QMouseEvent * );
-#ifndef QT_NO_WHEELEVENT    
+#ifndef QT_NO_WHEELEVENT
     /** Handles mousewheel events. Called from eventFilter */
     virtual bool eventFilter_wheel ( QObject *, QWheelEvent * );
-#endif    
+#endif
     /** Handles key events. Called from eventFilter */
     virtual bool eventFilter_key ( QObject *, QKeyEvent * );
 
@@ -281,6 +281,11 @@
   protected slots:
     /** delete the items that are queued for deletion */
     void deleteItemsToDelete();
+    /** Resizes all the child elements after the size of the agenda
+        changed. This is needed because Qt seems to have a bug when
+        the resizeEvent of one of the widgets in a splitter takes a
+        lot of time / does a lot of resizes.... see bug 80114 */
+    void resizeAllContents();
 
   private:
     void init();


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

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