#include "kcategorydrawer.h"
#include "kcategorizedsortfilterproxymodel.h"
+// By defining DOLPHIN_DRAGANDDROP the custom drag and drop implementation of
+// KCategorizedView is bypassed to have a consistent drag and drop look for all
+// views. Hopefully transparent pixmaps for drag objects will be supported in
+// Qt 4.4, so that this workaround can be skipped.
+#define DOLPHIN_DRAGANDDROP
+
KCategorizedView::Private::Private(KCategorizedView *listView)
: listView(listView)
, categoryDrawer(0)
int lastItemBottom = cachedRectIndex(lastIndex).top() +
listView->spacing() + (listView->gridSize().isEmpty() ? 0 : listView->gridSize().height()) - listView->viewport()->height();
+ listView->horizontalScrollBar()->setRange(0, 0);
+
listView->verticalScrollBar()->setSingleStep(listView->viewport()->height() / 10);
listView->verticalScrollBar()->setPageStep(listView->viewport()->height());
listView->verticalScrollBar()->setRange(0, lastItemBottom);
(modelSortRole != proxyModel->sortRole()) ||
(modelSortColumn != proxyModel->sortColumn()) ||
(modelSortOrder != proxyModel->sortOrder()) ||
+ (modelLastRowCount != proxyModel->rowCount()) ||
(modelCategorized != proxyModel->isCategorizedModel()))))
{
// Force the view to update all elements
modelSortRole = proxyModel->sortRole();
modelSortColumn = proxyModel->sortColumn();
modelSortOrder = proxyModel->sortOrder();
+ modelLastRowCount = proxyModel->rowCount();
modelCategorized = proxyModel->isCategorizedModel();
}
}
d->modelSortRole = d->proxyModel->sortRole();
d->modelSortColumn = d->proxyModel->sortColumn();
d->modelSortOrder = d->proxyModel->sortOrder();
+ d->modelLastRowCount = d->proxyModel->rowCount();
d->modelCategorized = d->proxyModel->isCategorizedModel();
QObject::connect(d->proxyModel,
// ARGB window so it is no transparent. Use QAbstractItemView when
// this is fixed on Qt.
// QAbstractItemView::startDrag(supportedActions);
+#if !defined(DOLPHIN_DRAGANDDROP)
QListView::startDrag(supportedActions);
+#endif
d->isDragging = false;
d->mouseButtonPressed = false;
if ((viewMode() != KCategorizedView::IconMode) || !d->proxyModel ||
!d->categoryDrawer || !d->proxyModel->isCategorizedModel())
{
+#if defined(DOLPHIN_DRAGANDDROP)
+ QAbstractItemView::dragMoveEvent(event);
+#else
QListView::dragMoveEvent(event);
+#endif
return;
}
{
d->dragLeftViewport = true;
+#if defined(DOLPHIN_DRAGANDDROP)
+ QAbstractItemView::dragLeaveEvent(event);
+#else
QListView::dragLeaveEvent(event);
+#endif
+}
+
+void KCategorizedView::dropEvent(QDropEvent *event)
+{
+#if defined(DOLPHIN_DRAGANDDROP)
+ QAbstractItemView::dropEvent(event);
+#else
+ QListView::dropEvent(event);
+#endif
}
QModelIndex KCategorizedView::moveCursor(CursorAction cursorAction,