┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2012-02-23 15:51:47 +0100
committerPeter Penz <[email protected]>2012-02-23 15:55:06 +0100
commita6627b9f2345eac9cc650aa9f87f9c69db8c707f (patch)
treec0da3dc2c3f3ed9a594a0d5271b0886127194dd6
parentdbc5fd7a491f95ca4084a113d0f902ea975478fd (diff)
Fix drag and drop issue when dragging between windows
Explicitly check whether a dragging is ongoing to decide whether a tooltip may be shown or not, just using QApplication::mouseButtons() is not sufficient when dragging between windows. BUG: 294533 FIXED-IN: 4.8.1
-rw-r--r--src/views/dolphinview.cpp20
-rw-r--r--src/views/dolphinview.h10
2 files changed, 25 insertions, 5 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp
index 750cbb998..700427ed7 100644
--- a/src/views/dolphinview.cpp
+++ b/src/views/dolphinview.cpp
@@ -81,6 +81,7 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) :
m_tabsForFiles(false),
m_assureVisibleCurrentIndex(false),
m_isFolderWritable(true),
+ m_dragging(false),
m_url(url),
m_mode(DolphinView::IconsView),
m_additionalInfoList(),
@@ -155,6 +156,7 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) :
}
KItemListView* view = controller->view();
+ view->installEventFilter(this);
connect(view, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
this, SLOT(slotSortOrderChangedByHeader(Qt::SortOrder,Qt::SortOrder)));
connect(view, SIGNAL(sortRoleChanged(QByteArray,QByteArray)),
@@ -674,6 +676,22 @@ bool DolphinView::eventFilter(QObject* watched, QEvent* event)
}
break;
+ case QEvent::GraphicsSceneDragEnter:
+ if (watched == m_container->controller()->view()) {
+ m_dragging = true;
+ }
+ break;
+
+ case QEvent::GraphicsSceneDragLeave:
+ if (watched == m_container->controller()->view()) {
+ m_dragging = false;
+ }
+ break;
+
+ case QEvent::GraphicsSceneDrop:
+ if (watched == m_container->controller()->view()) {
+ m_dragging = false;
+ }
default:
break;
}
@@ -808,7 +826,7 @@ void DolphinView::slotItemHovered(int index)
{
const KFileItem item = fileItemModel()->fileItem(index);
- if (GeneralSettings::showToolTips() && hasFocus() && QApplication::mouseButtons() == Qt::NoButton) {
+ if (GeneralSettings::showToolTips() && !m_dragging) {
QRectF itemRect = m_container->controller()->view()->itemContextRect(index);
const QPoint pos = m_container->mapToGlobal(itemRect.topLeft().toPoint());
itemRect.moveTo(pos);
diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h
index bc65a8b77..42ad26098 100644
--- a/src/views/dolphinview.h
+++ b/src/views/dolphinview.h
@@ -741,10 +741,12 @@ private:
static QString fileSizeText(KIO::filesize_t fileSize);
private:
- bool m_active : 1;
- bool m_tabsForFiles : 1;
- bool m_assureVisibleCurrentIndex : 1;
- bool m_isFolderWritable : 1;
+ bool m_active;
+ bool m_tabsForFiles;
+ bool m_assureVisibleCurrentIndex;
+ bool m_isFolderWritable;
+ bool m_dragging; // True if a dragging is done. Required to be able to decide whether a
+ // tooltip may be shown when hovering an item.
KUrl m_url;
Mode m_mode;