From d524b384c359d48eb13dd9cb3dd23ba99bbaa093 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 12 May 2007 13:41:31 +0000 Subject: [PATCH] hover fix for the details mode: hovering should only be done on the name column, all other columns behave as viewport area svn path=/trunk/KDE/kdebase/apps/; revision=663861 --- src/dolphindetailsview.cpp | 14 +++++++++++++- src/dolphindetailsview.h | 9 +++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp index df07fb9a5..87fa85165 100644 --- a/src/dolphindetailsview.cpp +++ b/src/dolphindetailsview.cpp @@ -71,7 +71,7 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr connect(this, SIGNAL(activated(const QModelIndex&)), controller, SLOT(triggerItem(const QModelIndex&))); connect(this, SIGNAL(entered(const QModelIndex&)), - controller, SLOT(emitItemEntered(const QModelIndex&))); + this, SLOT(slotEntered(const QModelIndex&))); connect(this, SIGNAL(viewportEntered()), controller, SLOT(emitViewportEntered())); connect(controller, SIGNAL(zoomIn()), @@ -192,6 +192,18 @@ void DolphinDetailsView::synchronizeSortingState(int column) m_controller->indicateSortOrderChange(sortOrder); } +void DolphinDetailsView::slotEntered(const QModelIndex& index) +{ + const QPoint pos = viewport()->mapFromGlobal(QCursor::pos()); + const int nameColumnWidth = header()->sectionSize(KDirModel::Name); + if (pos.x() < nameColumnWidth) { + m_controller->emitItemEntered(index); + } + else { + m_controller->emitViewportEntered(); + } +} + void DolphinDetailsView::zoomIn() { if (isZoomInPossible()) { diff --git a/src/dolphindetailsview.h b/src/dolphindetailsview.h index e90a0bd89..03f1b8d53 100644 --- a/src/dolphindetailsview.h +++ b/src/dolphindetailsview.h @@ -72,6 +72,15 @@ private slots: */ void synchronizeSortingState(int column); + /** + * Is invoked when the mouse cursor has entered an item. The controller + * gets informed to emit the itemEntered() signal if the mouse cursor + * is above the name column. Otherwise the controller gets informed + * to emit the itemViewportEntered() signal (all other columns should + * behave as viewport area). + */ + void slotEntered(const QModelIndex& index); + void zoomIn(); void zoomOut(); -- 2.47.3