From 565c6d843a171d48a48cc74b061105f087f80429 Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Mon, 28 Oct 2024 09:41:09 +0300 Subject: [PATCH] Correctly delete the moved search tab PR #21687. Closes #21675. --- src/gui/search/searchwidget.cpp | 8 +++++++- src/gui/search/searchwidget.h | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/search/searchwidget.cpp b/src/gui/search/searchwidget.cpp index 1128a561e..cabd8a135 100644 --- a/src/gui/search/searchwidget.cpp +++ b/src/gui/search/searchwidget.cpp @@ -1,7 +1,7 @@ /* * Bittorrent Client using Qt and libtorrent. + * Copyright (C) 2015-2024 Vladimir Golovnev * Copyright (C) 2020, Will Da Silva - * Copyright (C) 2015, 2018 Vladimir Golovnev * Copyright (C) 2006 Christophe Dumez * * This program is free software; you can redistribute it and/or @@ -120,6 +120,7 @@ SearchWidget::SearchWidget(IGUIApplication *app, MainWindow *mainWindow) #endif connect(m_ui->tabWidget, &QTabWidget::tabCloseRequested, this, &SearchWidget::closeTab); connect(m_ui->tabWidget, &QTabWidget::currentChanged, this, &SearchWidget::tabChanged); + connect(m_ui->tabWidget->tabBar(), &QTabBar::tabMoved, this, &SearchWidget::tabMoved); const auto *searchManager = SearchPluginManager::instance(); const auto onPluginChanged = [this]() @@ -262,6 +263,11 @@ void SearchWidget::tabChanged(const int index) m_currentSearchTab = ((index < 0) ? nullptr : m_allTabs.at(m_ui->tabWidget->currentIndex())); } +void SearchWidget::tabMoved(const int from, const int to) +{ + m_allTabs.move(from, to); +} + void SearchWidget::selectMultipleBox([[maybe_unused]] const int index) { if (selectedPlugin() == u"multi") diff --git a/src/gui/search/searchwidget.h b/src/gui/search/searchwidget.h index 06544308c..a1b18e470 100644 --- a/src/gui/search/searchwidget.h +++ b/src/gui/search/searchwidget.h @@ -1,7 +1,7 @@ /* * Bittorrent Client using Qt and libtorrent. + * Copyright (C) 2015-2024 Vladimir Golovnev * Copyright (C) 2020, Will Da Silva - * Copyright (C) 2015, 2018 Vladimir Golovnev * Copyright (C) 2006 Christophe Dumez * * This program is free software; you can redistribute it and/or @@ -66,6 +66,7 @@ private slots: private: bool eventFilter(QObject *object, QEvent *event) override; void tabChanged(int index); + void tabMoved(int from, int to); void closeTab(int index); void closeAllTabs(); void tabStatusChanged(QWidget *tab);