1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

TabBar: Support drop moving tabs from the same tabbar

Closes #2602
This commit is contained in:
David Rosca 2018-02-12 16:26:54 +01:00
parent eb90925a32
commit b07d9cc976
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8

View File

@ -642,7 +642,7 @@ void TabBar::dragMoveEvent(QDragMoveEvent *event)
const int index = tabAt(event->pos());
const QMimeData* mime = event->mimeData();
if (index == -1 || (mime->hasFormat(MIMETYPE) && event->source() == this)) {
if (index == -1) {
ComboTabBar::dragMoveEvent(event);
return;
}
@ -680,10 +680,6 @@ void TabBar::dropEvent(QDropEvent* event)
event->acceptProposedAction();
if (mime->hasFormat(MIMETYPE) && event->source() == this) {
return;
}
TabBar *sourceTabBar = qobject_cast<TabBar*>(event->source());
int index = tabAt(event->pos());
@ -722,9 +718,13 @@ void TabBar::dropEvent(QDropEvent* event)
} else if (mime->hasFormat(MIMETYPE) && sourceTabBar) {
WebTab *tab = sourceTabBar->webTab();
if (tab) {
sourceTabBar->m_tabWidget->detachTab(tab);
tab->setPinned(index < pinnedTabsCount());
m_tabWidget->insertView(newIndex, tab, Qz::NT_SelectedTab);
if (sourceTabBar == this) {
tab->moveTab(newIndex > tab->tabIndex() ? newIndex - 1 : newIndex);
} else {
sourceTabBar->m_tabWidget->detachTab(tab);
tab->setPinned(index < pinnedTabsCount());
m_tabWidget->insertView(newIndex, tab, Qz::NT_SelectedTab);
}
}
}
}