From: Peter Penz Date: Sat, 15 Dec 2007 16:25:23 +0000 (+0000) Subject: fixed selection behavior in the details view (when the selection enters the viewport... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/ecce6e87f8540aa690a2098d89e22b4ab85e325f fixed selection behavior in the details view (when the selection enters the viewport area, Qt's QTreeView does no selection at all, even if the items are still within the elastic band) svn path=/trunk/KDE/kdebase/apps/; revision=748819 --- diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp index 68b288b0b..d90527767 100644 --- a/src/dolphindetailsview.cpp +++ b/src/dolphindetailsview.cpp @@ -199,9 +199,24 @@ void DolphinDetailsView::mousePressEvent(QMouseEvent* event) void DolphinDetailsView::mouseMoveEvent(QMouseEvent* event) { - QTreeView::mouseMoveEvent(event); if (m_showElasticBand) { + const QPoint mousePos = event->pos(); + const QModelIndex index = indexAt(mousePos); + if (!index.isValid()) { + // the destination of the selection rectangle is above the viewport. In this + // case QTreeView does no selection at all, which is not the wanted behavior + // in Dolphin -> select all items within the elastic band rectangle + clearSelection(); + if (mousePos.x() < header()->sectionSize(DolphinModel::Name)) { + setSelection(QRect(m_elasticBandOrigin, m_elasticBandDestination), + QItemSelectionModel::Select); + } + } + + QTreeView::mouseMoveEvent(event); updateElasticBand(); + } else { + QTreeView::mouseMoveEvent(event); } }