From eda07dc98644978c7134857c429507babf5ae57d Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 2 Jun 2007 15:03:03 +0000 Subject: [PATCH] * Fix triggering an assertion when the elastic band is already hidden. * Assure that the selection gets cleared if a click on the viewport is done. svn path=/trunk/KDE/kdebase/apps/; revision=670759 --- src/dolphindetailsview.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp index 998d3c8708..961fb15a3c 100644 --- a/src/dolphindetailsview.cpp +++ b/src/dolphindetailsview.cpp @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -154,6 +155,13 @@ void DolphinDetailsView::contextMenuEvent(QContextMenuEvent* event) void DolphinDetailsView::mousePressEvent(QMouseEvent* event) { + if (!indexAt(event->pos()).isValid()) { + const Qt::KeyboardModifiers modifier = QApplication::keyboardModifiers(); + if (!(modifier & Qt::ShiftModifier) && !(modifier & Qt::ControlModifier)) { + clearSelection(); + } + } + QTreeView::mousePressEvent(event); if (event->button() == Qt::LeftButton) { @@ -178,8 +186,10 @@ void DolphinDetailsView::mouseMoveEvent(QMouseEvent* event) void DolphinDetailsView::mouseReleaseEvent(QMouseEvent* event) { QTreeView::mouseReleaseEvent(event); - updateElasticBand(); - m_showElasticBand = false; + if (m_showElasticBand) { + updateElasticBand(); + m_showElasticBand = false; + } m_controller->triggerActivation(); } @@ -188,8 +198,11 @@ void DolphinDetailsView::dragEnterEvent(QDragEnterEvent* event) if (event->mimeData()->hasUrls()) { event->acceptProposedAction(); } - updateElasticBand(); - m_showElasticBand = false; + + if (m_showElasticBand) { + updateElasticBand(); + m_showElasticBand = false; + } } void DolphinDetailsView::dropEvent(QDropEvent* event)