From: Simon Paul St James Date: Sat, 3 Jan 2009 16:00:21 +0000 (+0000) Subject: contentsPos turned out to be a little broken - it would always return (0,0), except... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/e896fc8e1168be8fe20bb19320b4d37b81b4a80b?ds=inline 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 --- diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp index 9ccb75b8e..dc9f10956 100644 --- a/src/dolphindetailsview.cpp +++ b/src/dolphindetailsview.cpp @@ -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; diff --git a/src/dolphindetailsview.h b/src/dolphindetailsview.h index 8e48e8827..7707c0773 100644 --- a/src/dolphindetailsview.h +++ b/src/dolphindetailsview.h @@ -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; /**