]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphintabbar.cpp
DolphinMainWindowTest: Add unit test for autosave session feature
[dolphin.git] / src / dolphintabbar.cpp
index 82695ac21a32f16ce372f95bf63a8bea6b421959..c70089223da4a6b62525c46e6f0c1f7673ee742f 100644 (file)
@@ -32,7 +32,7 @@ DolphinTabBar::DolphinTabBar(QWidget *parent)
 void DolphinTabBar::dragEnterEvent(QDragEnterEvent *event)
 {
     const QMimeData *mimeData = event->mimeData();
-    const int index = tabAt(event->pos());
+    const int index = tabAt(event->position().toPoint());
 
     if (mimeData->hasUrls()) {
         event->acceptProposedAction();
@@ -52,7 +52,7 @@ void DolphinTabBar::dragLeaveEvent(QDragLeaveEvent *event)
 void DolphinTabBar::dragMoveEvent(QDragMoveEvent *event)
 {
     const QMimeData *mimeData = event->mimeData();
-    const int index = tabAt(event->pos());
+    const int index = tabAt(event->position().toPoint());
 
     if (mimeData->hasUrls()) {
         updateAutoActivationTimer(index);
@@ -67,7 +67,7 @@ void DolphinTabBar::dropEvent(QDropEvent *event)
     updateAutoActivationTimer(-1);
 
     const QMimeData *mimeData = event->mimeData();
-    const int index = tabAt(event->pos());
+    const int index = tabAt(event->position().toPoint());
 
     if (mimeData->hasUrls()) {
         Q_EMIT tabDropEvent(index, event);
@@ -103,14 +103,15 @@ void DolphinTabBar::mouseReleaseEvent(QMouseEvent *event)
 
 void DolphinTabBar::mouseDoubleClickEvent(QMouseEvent *event)
 {
-    const int index = tabAt(event->pos());
+    int index = tabAt(event->pos());
 
     if (index < 0) {
-        // Double click on the empty tabbar area opens a new activated tab
-        // with the url from the current tab.
-        Q_EMIT openNewActivatedTab(currentIndex());
-        return;
+        // empty tabbar area case
+        index = currentIndex();
     }
+    // Double click on the tabbar opens a new activated tab
+    // with the url from the doubleclicked tab or currentTab otherwise.
+    Q_EMIT openNewActivatedTab(index);
 
     QTabBar::mouseDoubleClickEvent(event);
 }
@@ -171,3 +172,5 @@ void DolphinTabBar::updateAutoActivationTimer(const int index)
         }
     }
 }
+
+#include "moc_dolphintabbar.cpp"