From: Peter Penz Date: Wed, 16 Apr 2008 20:26:21 +0000 (+0000) Subject: if the mouse is above an item and moved very fast outside the widget, no viewportEnte... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/eb36093c2c5a8782c7c7f6be92881c108c30a5b1 if the mouse is above an item and moved very fast outside the widget, no viewportEntered() signal might be emitted although the mouse has been moved above the viewport svn path=/trunk/KDE/kdebase/apps/; revision=797742 --- diff --git a/src/dolphincolumnwidget.cpp b/src/dolphincolumnwidget.cpp index e7993b975..ee051ff1a 100644 --- a/src/dolphincolumnwidget.cpp +++ b/src/dolphincolumnwidget.cpp @@ -373,6 +373,15 @@ void DolphinColumnWidget::wheelEvent(QWheelEvent* event) QListView::wheelEvent(event); } +void DolphinColumnWidget::leaveEvent(QEvent* event) +{ + QListView::leaveEvent(event); + // if the mouse is above an item and moved very fast outside the widget, + // no viewportEntered() signal might be emitted although the mouse has been moved + // above the viewport + m_view->m_controller->emitViewportEntered(); +} + void DolphinColumnWidget::selectionChanged(const QItemSelection& selected, const QItemSelection& deselected) { QListView::selectionChanged(selected, deselected); diff --git a/src/dolphincolumnwidget.h b/src/dolphincolumnwidget.h index 11acb6d02..e51ff5d97 100644 --- a/src/dolphincolumnwidget.h +++ b/src/dolphincolumnwidget.h @@ -115,6 +115,7 @@ protected: virtual void keyPressEvent(QKeyEvent* event); virtual void contextMenuEvent(QContextMenuEvent* event); virtual void wheelEvent(QWheelEvent* event); + virtual void leaveEvent(QEvent* event); virtual void selectionChanged(const QItemSelection& selected, const QItemSelection& deselected); private slots: diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp index 470cafa1d..aef034df1 100644 --- a/src/dolphindetailsview.cpp +++ b/src/dolphindetailsview.cpp @@ -134,6 +134,7 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr updateDecorationSize(); setFocus(); + viewport()->installEventFilter(this); connect(KGlobalSettings::self(), SIGNAL(kdisplayFontChanged()), this, SLOT(updateFont())); @@ -363,6 +364,18 @@ void DolphinDetailsView::currentChanged(const QModelIndex& current, const QModel } } +bool DolphinDetailsView::eventFilter(QObject* watched, QEvent* event) +{ + if ((watched == viewport()) && (event->type() == QEvent::Leave)) { + // if the mouse is above an item and moved very fast outside the widget, + // no viewportEntered() signal might be emitted although the mouse has been moved + // above the viewport + m_controller->emitViewportEntered(); + } + + return QTreeView::eventFilter(watched, event); +} + void DolphinDetailsView::setSortIndicatorSection(DolphinView::Sorting sorting) { QHeaderView* headerView = header(); diff --git a/src/dolphindetailsview.h b/src/dolphindetailsview.h index 88471746d..a92e113dd 100644 --- a/src/dolphindetailsview.h +++ b/src/dolphindetailsview.h @@ -60,6 +60,7 @@ protected: virtual void resizeEvent(QResizeEvent* event); virtual void wheelEvent(QWheelEvent* event); virtual void currentChanged(const QModelIndex& current, const QModelIndex& previous); + virtual bool eventFilter(QObject* watched, QEvent* event); private slots: /** diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp index 959f152f0..7b9ddd6ac 100644 --- a/src/dolphiniconsview.cpp +++ b/src/dolphiniconsview.cpp @@ -276,6 +276,15 @@ void DolphinIconsView::showEvent(QShowEvent* event) KCategorizedView::showEvent(event); } +void DolphinIconsView::leaveEvent(QEvent* event) +{ + KCategorizedView::leaveEvent(event); + // if the mouse is above an item and moved very fast outside the widget, + // no viewportEntered() signal might be emitted although the mouse has been moved + // above the viewport + m_controller->emitViewportEntered(); +} + void DolphinIconsView::slotShowPreviewChanged() { const DolphinView* view = m_controller->dolphinView(); diff --git a/src/dolphiniconsview.h b/src/dolphiniconsview.h index c912b99f7..56d492ce1 100644 --- a/src/dolphiniconsview.h +++ b/src/dolphiniconsview.h @@ -63,6 +63,7 @@ protected: virtual void keyPressEvent(QKeyEvent* event); virtual void wheelEvent(QWheelEvent* event); virtual void showEvent(QShowEvent* event); + virtual void leaveEvent(QEvent* event); private slots: void slotShowPreviewChanged();