Skip to content

Commit

Permalink
Correctly delete the moved search tab
Browse files Browse the repository at this point in the history
  • Loading branch information
glassez authored Oct 28, 2024
1 parent 91b2687 commit 84d8952
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/gui/search/searchwidget.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2015-2024 Vladimir Golovnev <[email protected]>
* Copyright (C) 2020, Will Da Silva <[email protected]>
* Copyright (C) 2015, 2018 Vladimir Golovnev <[email protected]>
* Copyright (C) 2006 Christophe Dumez <[email protected]>
*
* This program is free software; you can redistribute it and/or
Expand Down Expand Up @@ -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]()
Expand Down Expand Up @@ -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")
Expand Down
3 changes: 2 additions & 1 deletion src/gui/search/searchwidget.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2015-2024 Vladimir Golovnev <[email protected]>
* Copyright (C) 2020, Will Da Silva <[email protected]>
* Copyright (C) 2015, 2018 Vladimir Golovnev <[email protected]>
* Copyright (C) 2006 Christophe Dumez <[email protected]>
*
* This program is free software; you can redistribute it and/or
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 84d8952

Please sign in to comment.