Skip to content

Commit 84d8952

Browse files
authored
Correctly delete the moved search tab
PR qbittorrent#21687. Closes qbittorrent#21675.
1 parent 91b2687 commit 84d8952

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/gui/search/searchwidget.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Bittorrent Client using Qt and libtorrent.
3+
* Copyright (C) 2015-2024 Vladimir Golovnev <[email protected]>
34
* Copyright (C) 2020, Will Da Silva <[email protected]>
4-
* Copyright (C) 2015, 2018 Vladimir Golovnev <[email protected]>
55
* Copyright (C) 2006 Christophe Dumez <[email protected]>
66
*
77
* This program is free software; you can redistribute it and/or
@@ -120,6 +120,7 @@ SearchWidget::SearchWidget(IGUIApplication *app, MainWindow *mainWindow)
120120
#endif
121121
connect(m_ui->tabWidget, &QTabWidget::tabCloseRequested, this, &SearchWidget::closeTab);
122122
connect(m_ui->tabWidget, &QTabWidget::currentChanged, this, &SearchWidget::tabChanged);
123+
connect(m_ui->tabWidget->tabBar(), &QTabBar::tabMoved, this, &SearchWidget::tabMoved);
123124

124125
const auto *searchManager = SearchPluginManager::instance();
125126
const auto onPluginChanged = [this]()
@@ -262,6 +263,11 @@ void SearchWidget::tabChanged(const int index)
262263
m_currentSearchTab = ((index < 0) ? nullptr : m_allTabs.at(m_ui->tabWidget->currentIndex()));
263264
}
264265

266+
void SearchWidget::tabMoved(const int from, const int to)
267+
{
268+
m_allTabs.move(from, to);
269+
}
270+
265271
void SearchWidget::selectMultipleBox([[maybe_unused]] const int index)
266272
{
267273
if (selectedPlugin() == u"multi")

src/gui/search/searchwidget.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Bittorrent Client using Qt and libtorrent.
3+
* Copyright (C) 2015-2024 Vladimir Golovnev <[email protected]>
34
* Copyright (C) 2020, Will Da Silva <[email protected]>
4-
* Copyright (C) 2015, 2018 Vladimir Golovnev <[email protected]>
55
* Copyright (C) 2006 Christophe Dumez <[email protected]>
66
*
77
* This program is free software; you can redistribute it and/or
@@ -66,6 +66,7 @@ private slots:
6666
private:
6767
bool eventFilter(QObject *object, QEvent *event) override;
6868
void tabChanged(int index);
69+
void tabMoved(int from, int to);
6970
void closeTab(int index);
7071
void closeAllTabs();
7172
void tabStatusChanged(QWidget *tab);

0 commit comments

Comments
 (0)