diff --git a/src/lib/tabwidget/tabbar.cpp b/src/lib/tabwidget/tabbar.cpp index bcdf24056..ad2779f00 100644 --- a/src/lib/tabwidget/tabbar.cpp +++ b/src/lib/tabwidget/tabbar.cpp @@ -484,7 +484,7 @@ void TabBar::mouseMoveEvent(QMouseEvent* event) } else if (eventY > height()) { offset = eventY - height(); } - if (count() > 1 && offset > QApplication::startDragDistance()) { + if (offset > QApplication::startDragDistance()) { const QPoint global = mapToGlobal(m_dragStartPosition); QWidget *w = QApplication::widgetAt(global); if (w) { diff --git a/src/lib/tabwidget/tabwidget.cpp b/src/lib/tabwidget/tabwidget.cpp index 1a039f32d..6b4ab6c51 100644 --- a/src/lib/tabwidget/tabwidget.cpp +++ b/src/lib/tabwidget/tabwidget.cpp @@ -655,16 +655,15 @@ void TabWidget::detachTab(WebTab* tab) disconnect(tab->webView(), SIGNAL(ipChanged(QString)), m_window->ipLabel(), SLOT(setText(QString))); tab->detach(); + + if (count() == 0) { + m_window->close(); + } } void TabWidget::detachTab(int index) { WebTab* tab = weTab(index); - - if (count() <= 1) { - return; - } - detachTab(tab); tab->setPinned(false); diff --git a/src/lib/webtab/webtab.cpp b/src/lib/webtab/webtab.cpp index 9f5164ac1..ba03d8b16 100644 --- a/src/lib/webtab/webtab.cpp +++ b/src/lib/webtab/webtab.cpp @@ -1,6 +1,6 @@ /* ============================================================ * Falkon - Qt web browser -* Copyright (C) 2010-2017 David Rosca +* Copyright (C) 2010-2018 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -274,7 +274,8 @@ void WebTab::detach() Q_ASSERT(m_tabBar); // Remove icon from tab - m_tabBar->setTabButton(tabIndex(), m_tabBar->iconButtonPosition(), 0); + m_tabBar->setTabButton(tabIndex(), m_tabBar->iconButtonPosition(), nullptr); + m_tabIcon->setParent(this); // Remove the tab from tabbar setParent(0);