contentsPos turned out to be a little broken - it would always return (0,0), except in a very unusual set of circumstances where it returned ... "different" values, causing very odd behaviour with the elastic band :) Remove it.

svn path=/trunk/KDE/kdebase/apps/; revision=904995
This commit is contained in:
Simon Paul St James 2009-01-03 16:00:21 +00:00
parent 64059e5083
commit e896fc8e11
2 changed files with 3 additions and 27 deletions

View file

@ -236,9 +236,8 @@ void DolphinDetailsView::mousePressEvent(QMouseEvent* event)
m_band.show = true;
// Incremental update data will not be useful - start from scratch.
m_band.ignoreOldInfo = true;
const QPoint pos = contentsPos();
const QPoint scrollPos(horizontalScrollBar()->value(), verticalScrollBar()->value());
m_band.origin = event->pos() + pos + scrollPos;
m_band.origin = event->pos() + scrollPos;
m_band.destination = m_band.origin;
m_band.originalSelection = selectionModel()->selection();
}
@ -522,7 +521,6 @@ void DolphinDetailsView::updateElasticBand()
if (m_band.destination.x() < 0) {
m_band.destination.setX(0);
}
dirtyRegion = dirtyRegion.united(elasticBandRect());
setDirtyRegion(dirtyRegion);
}
@ -530,11 +528,10 @@ void DolphinDetailsView::updateElasticBand()
QRect DolphinDetailsView::elasticBandRect() const
{
const QPoint pos(contentsPos());
const QPoint scrollPos(horizontalScrollBar()->value(), verticalScrollBar()->value());
const QPoint topLeft = m_band.origin - pos - scrollPos;
const QPoint bottomRight = m_band.destination - pos - scrollPos;
const QPoint topLeft = m_band.origin - scrollPos;
const QPoint bottomRight = m_band.destination - scrollPos;
return QRect(topLeft, bottomRight).normalized();
}
@ -846,24 +843,6 @@ void DolphinDetailsView::updateDecorationSize(bool showPreview)
doItemsLayout();
}
QPoint DolphinDetailsView::contentsPos() const
{
// implementation note: the horizonal position is ignored currently, as no
// horizontal scrolling is done anyway during a selection
const QScrollBar* scrollbar = verticalScrollBar();
Q_ASSERT(scrollbar != 0);
const int maxHeight = maximumViewportSize().height();
const int height = scrollbar->maximum() - scrollbar->minimum() + 1;
const int visibleHeight = model()->rowCount() + 1 - height;
if (visibleHeight <= 0) {
return QPoint(0, 0);
}
const int y = scrollbar->sliderPosition() * maxHeight / visibleHeight;
return QPoint(0, y);
}
KFileItemDelegate::Information DolphinDetailsView::infoForColumn(int columnIndex) const
{
KFileItemDelegate::Information info = KFileItemDelegate::NoInformation;

View file

@ -161,9 +161,6 @@ private:
*/
void updateDecorationSize(bool showPreview);
/** Return the upper left position in pixels of the viewport content. */
QPoint contentsPos() const;
KFileItemDelegate::Information infoForColumn(int columnIndex) const;
/**