]> cloud.milkyroute.net Git - dolphin.git/commitdiff
contentsPos turned out to be a little broken - it would always return (0,0), except...
authorSimon Paul St James <kdedevel@etotheipiplusone.com>
Sat, 3 Jan 2009 16:00:21 +0000 (16:00 +0000)
committerSimon Paul St James <kdedevel@etotheipiplusone.com>
Sat, 3 Jan 2009 16:00:21 +0000 (16:00 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=904995

src/dolphindetailsview.cpp
src/dolphindetailsview.h

index 9ccb75b8ef5a19d52046a88198626479f2bb2ffd..dc9f1095625a4b34c2d1cf2c774c3d5ab116a1a9 100644 (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;
index 8e48e88274cb4c2f3bd93fe7d966abe7b72e7fbb..7707c077319394d801c0788b457c88ed4e51c70c 100644 (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;
 
     /**