]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kitemlistview.cpp
Fix slow scrolling in dock panels
[dolphin.git] / src / kitemviews / kitemlistview.cpp
index 8c93361e0db732378156cfcb37e252634eaf6956..d840509da71dba2b7b2259b2b7d7fa375dc82e4b 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "kitemlistview.h"
 
-#include <KDebug>
+#include "dolphindebug.h"
 #include "kitemlistcontainer.h"
 #include "kitemlistcontroller.h"
 #include "kitemlistheader.h"
 #include "private/kitemlistviewlayouter.h"
 #include "private/kitemlistviewanimation.h"
 
-#include <QCursor>
 #include <QGraphicsSceneMouseEvent>
 #include <QGraphicsView>
 #include <QPainter>
-#include <QPropertyAnimation>
 #include <QStyle>
 #include <QStyleOptionRubberBand>
 #include <QTimer>
+#include <QElapsedTimer>
 
 #include <algorithm>
 
@@ -345,6 +344,11 @@ QSizeF KItemListView::itemSize() const
     return m_itemSize;
 }
 
+QSizeF KItemListView::itemSizeHint() const
+{
+    return m_sizeHintResolver->maxSizeHint();
+}
+
 const KItemListStyleOption& KItemListView::styleOption() const
 {
     return m_styleOption;
@@ -544,7 +548,7 @@ void KItemListView::endTransaction()
     --m_activeTransactions;
     if (m_activeTransactions < 0) {
         m_activeTransactions = 0;
-        kWarning() << "Mismatch between beginTransaction()/endTransaction()";
+        qCWarning(DolphinDebug) << "Mismatch between beginTransaction()/endTransaction()";
     }
 
     if (m_activeTransactions == 0) {
@@ -1007,7 +1011,7 @@ void KItemListView::slotItemsInserted(const KItemRangeList& itemRanges)
         const int index = range.index + previouslyInsertedCount;
         const int count = range.count;
         if (index < 0 || count <= 0) {
-            kWarning() << "Invalid item range (index:" << index << ", count:" << count << ")";
+            qCWarning(DolphinDebug) << "Invalid item range (index:" << index << ", count:" << count << ")";
             continue;
         }
         previouslyInsertedCount += count;
@@ -1115,14 +1119,14 @@ void KItemListView::slotItemsRemoved(const KItemRangeList& itemRanges)
         const int index = range.index;
         const int count = range.count;
         if (index < 0 || count <= 0) {
-            kWarning() << "Invalid item range (index:" << index << ", count:" << count << ")";
+            qCWarning(DolphinDebug) << "Invalid item range (index:" << index << ", count:" << count << ")";
             continue;
         }
 
         const int firstRemovedIndex = index;
         const int lastRemovedIndex = index + count - 1;
 
-        // Remeber which items have to be moved because they are behind the removed range.
+        // Remember which items have to be moved because they are behind the removed range.
         QVector<int> itemsToMove;
 
         // Remove all KItemListWidget instances that got deleted
@@ -2438,7 +2442,7 @@ int KItemListView::showDropIndicator(const QPointF& pos)
         if (mappedPos.y() >= 0 && mappedPos.y() <= rect.height()) {
             if (m_model->supportsDropping(widget->index())) {
                 // Keep 30% of the rectangle as the gap instead of always having a fixed gap
-                const int gap = qMax(4.0, 0.3 * rect.height());
+                const int gap = qMax(qreal(4.0), qreal(0.3) * rect.height());
                 if (mappedPos.y() >= gap && mappedPos.y() <= rect.height() - gap) {
                     return -1;
                 }