[PATCH] Speed up iconView's setIcons 2x...

Koos Vriezen koos.vriezen at xs4all.nl
Mon Aug 26 16:41:46 BST 2002


On Mon, 26 Aug 2002, David Faure wrote:
> On Saturday 24 August 2002 13:50, Koos Vriezen wrote:
> > Just commenting out arrangeItemsInGrid() in KonqKfmIconView::newIconSize
> > already helps:
> >
> > --- ./iconview/konq_iconview.cc 2002/08/21 15:42:19     1.410
> > +++ ./iconview/konq_iconview.cc 2002/08/24 11:42:47
> > @@ -595,7 +595,7 @@ void KonqKfmIconView::newIconSize( int s
> >      m_pIconView->setIcons( size );
> >      if ( m_pProps->isShowingPreview() )
> >          m_pIconView->startImagePreview( m_pProps->previewSettings(), true
> > );
> > -    m_pIconView->arrangeItemsInGrid();
> > +    //m_pIconView->arrangeItemsInGrid();
> >  }
>
> The point is that changing the icon size (after listing) should
> rearrange the items so that they don't overlap each other (or have too much
> space between each other).
> Maybe (probably) that call must be moved, or made conditional, so that it
> only happens when _changing_ the icon size, not when loading a dir in
> the first place. Can you try changing icon sizes, to see if the patch
> created a problem?

Actually this is a quite trivial fix, m_pIconView->setIcons already does a
arrangeItemsInGrid in libkonq/konq_iconviewwidget.cc:822:

  if ( autoArrange() && (oldGridX != gridX() || !stopImagePreviewFor.isEmpty())
        arrangeItemsInGrid( false ); // take new grid into account

    update(); //Repaint later..

So what you say is already done.

The patch above handles going back and forward in history. There are still
other cases which show the same problem (icons first drawn unsorted and
a few msec later drawn sorted). Eg. after previewing a document and
pressing the back button.
Some traces of that case which I did yesterday:
  #0  0x40b12695 in QIconView::arrangeItemsInGrid ()
  #1  0x40b166bd in QIconView::adjustItems ()
  #2  0x40b16659 in QIconView::resizeEvent ()
  #3  0x409e5c25 in QWidget::event ()
  #9  0x40a8eaa6 in QScrollView::show ()
  #10 0x4008e7c8 in KonqFrame::attachInternal ()
  #11 0x4008e67c in KonqFrame::attach ()

  #0  0x40b12695 in QIconView::arrangeItemsInGrid ()
  #1  0x40b166bd in QIconView::adjustItems ()
  #2  0x40b16659 in QIconView::resizeEvent ()
  #10 0x409a65ee in QBoxLayout::setGeometry ()
  #11 0x4096a78e in QLayout::activate ()
  #12 0x4008e803 in KonqFrame::attachInternal ()
  #13 0x4008e67c in KonqFrame::attach ()
Next icons are added to the iconview
  #0  0x4125464d in KonqKfmIconView::newIconSize ()
  #1  0x41256552 in KonqKfmIconView::doOpenURL ()
  #2  0x4010c0e0 in KonqDirPart::openURL ()
  #3  0x40155fae in KParts::BrowserExtension::restoreState ()
  #4  0x41258f3c in IconViewBrowserExtension::restoreState ()
  #5  0x4007c2c4 in KonqView::go ()
Next update event occurs. This is not the update from
libkonq/konq_iconviewwidget.cc:822. Commenting it out, doesn't improve it.
  #0  0x40b12695 in QIconView::arrangeItemsInGrid ()
  #1  0x40b1a3fc in QIconView::sizeHint ()
  #2  0x409694de in QWidgetItem::sizeHint ()
  #3  0x409a71bb in QBoxLayout::setupGeom ()
  #4  0x409a6107 in QBoxLayout::setGeometry ()
  #5  0x4096a78e in QLayout::activate ()
  #6  0x40969ece in QLayout::eventFilter ()
  #8  0x409b7a21 in QObject::event ()

  #0  0x40b11fa8 in QIconView::drawContents ()
  #1  0x40a90fac in QScrollView::drawContentsOffset ()
  #2  0x40a8fc0e in QScrollView::viewportPaintEvent ()
  #5  0x409b7a21 in QObject::event ()

  #0  0x40b11fa8 in QIconView::drawContents ()
  #1  0x40a90fac in QScrollView::drawContentsOffset ()
  #2  0x40a8fc0e in QScrollView::viewportPaintEvent ()
  #5  0x409b7a21 in QObject::event ()
  #11 0x40a90f31 in QScrollView::repaintContents ()
  #12 0x40b139f3 in QIconView::repaintItem ()
  #15 0x400f8c19 in KonqIconViewWidget::focusOutEvent ()

  #0  0x40b11fa8 in QIconView::drawContents ()
  #1  0x40a90fac in QScrollView::drawContentsOffset ()
  #2  0x40a8fc0e in QScrollView::viewportPaintEvent ()
  #5  0x409b7a21 in QObject::event ()
<icons are painted unsorted two times>
Next timer event for updating (slotUpdate) and sorting occurs
  #0  0x40b12695 in QIconView::arrangeItemsInGrid ()
  #1  0x40b1a2f0 in QIconView::sort ()
  #2  0x40b10b24 in QIconView::slotUpdate ()
  #8  0x40c20b29 in QTimer::timeout ()
  #9  0x409d4bbf in QTimer::event ()

  #0  0x40b11fa8 in QIconView::drawContents ()
  #1  0x40a90fac in QScrollView::drawContentsOffset ()
  #2  0x40a8fc0e in QScrollView::viewportPaintEvent ()
  #5  0x409b7a21 in QObject::event ()
  #10 0x4094e1d3 in QWidget::repaint ()
  #11 0x40a90f31 in QScrollView::repaintContents ()
  #12 0x40b12b97 in QIconView::arrangeItemsInGrid ()
<icons are painted sorted>

Didn't find the cause of this yet.

Koos







More information about the kfm-devel mailing list