mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
Tabs: Allow to detach tab from window with only one tab
Window will be closed after detaching this tab.
This commit is contained in:
parent
3eac8bd161
commit
8817493c68
|
@ -484,7 +484,7 @@ void TabBar::mouseMoveEvent(QMouseEvent* event)
|
||||||
} else if (eventY > height()) {
|
} else if (eventY > height()) {
|
||||||
offset = eventY - height();
|
offset = eventY - height();
|
||||||
}
|
}
|
||||||
if (count() > 1 && offset > QApplication::startDragDistance()) {
|
if (offset > QApplication::startDragDistance()) {
|
||||||
const QPoint global = mapToGlobal(m_dragStartPosition);
|
const QPoint global = mapToGlobal(m_dragStartPosition);
|
||||||
QWidget *w = QApplication::widgetAt(global);
|
QWidget *w = QApplication::widgetAt(global);
|
||||||
if (w) {
|
if (w) {
|
||||||
|
|
|
@ -655,16 +655,15 @@ void TabWidget::detachTab(WebTab* tab)
|
||||||
disconnect(tab->webView(), SIGNAL(ipChanged(QString)), m_window->ipLabel(), SLOT(setText(QString)));
|
disconnect(tab->webView(), SIGNAL(ipChanged(QString)), m_window->ipLabel(), SLOT(setText(QString)));
|
||||||
|
|
||||||
tab->detach();
|
tab->detach();
|
||||||
|
|
||||||
|
if (count() == 0) {
|
||||||
|
m_window->close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabWidget::detachTab(int index)
|
void TabWidget::detachTab(int index)
|
||||||
{
|
{
|
||||||
WebTab* tab = weTab(index);
|
WebTab* tab = weTab(index);
|
||||||
|
|
||||||
if (count() <= 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
detachTab(tab);
|
detachTab(tab);
|
||||||
tab->setPinned(false);
|
tab->setPinned(false);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* ============================================================
|
/* ============================================================
|
||||||
* Falkon - Qt web browser
|
* Falkon - Qt web browser
|
||||||
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
|
* Copyright (C) 2010-2018 David Rosca <nowrep@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -274,7 +274,8 @@ void WebTab::detach()
|
||||||
Q_ASSERT(m_tabBar);
|
Q_ASSERT(m_tabBar);
|
||||||
|
|
||||||
// Remove icon from tab
|
// 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
|
// Remove the tab from tabbar
|
||||||
setParent(0);
|
setParent(0);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user